Cordonel Pressure sensor report

This commit is contained in:
Stoyan Zlatev
2023-05-23 15:35:52 +02:00
parent 03ec6fcb77
commit b5beb98a8c
14 changed files with 304 additions and 9 deletions
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
@@ -6,6 +6,8 @@
public interface IReportService : ITransient
{
CordonelPressureSensorModel LoadCordonelPressureSensorReport(CordonelPressureSensorModel model = null);
HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null);
IEnumerable<HeliumPressurePoint> LoadHeliumPressureResults(int testId);
@@ -64,6 +64,9 @@
<Compile Include="Models\Employee.cs" />
<Compile Include="Models\HttpResponseModel.cs" />
<Compile Include="Models\MissingItem.cs" />
<Compile Include="Models\Reports\CordonelPressureSensorFilter.cs" />
<Compile Include="Models\Reports\CordonelPressureSensorItem.cs" />
<Compile Include="Models\Reports\CordonelPressureSensorModel.cs" />
<Compile Include="Models\Reports\HeliumPressurePoint.cs" />
<Compile Include="Models\Reports\HeliumReportFilter.cs" />
<Compile Include="Models\Reports\KottmannReportFilter.cs" />
@@ -0,0 +1,24 @@
namespace LaaProductionWeb.Services.Models.Reports
{
public class CordonelPressureSensorFilter : ReportFilter
{
public CordonelPressureSensorFilter()
{
var model = default(CordonelPressureSensorItem);
this.Add(model.Text(x => x.AuftragNr, this.Count));
this.Add(model.Text(x => x.PosNr, this.Count));
this.Add(model.Text(x => x.SerialNr, this.Count));
this.Add(model.Text(x => x.CustomerSerialNr, this.Count));
this.Add(model.Text(x => x.IdentNr, this.Count));
this.Add(model.Text(x => x.PcbId, this.Count));
this.Add(model.Text(x => x.TypeI, this.Count));
this.Add(model.Text(x => x.TypeII, this.Count));
this.Add(model.Text(x => x.Nennweite, this.Count));
this.Add(model.Text(x => x.Baulaenge, this.Count));
this.Add(model.Text(x => x.AVGPressure, this.Count));
this.Add(model.Boolean(x => x.TestPassed, this.Count));
this.Add(model.DateTime(x => x.TestDate, this.Count, -1));
}
}
}
@@ -0,0 +1,61 @@
namespace LaaProductionWeb.Services.Models.Reports
{
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
public class CordonelPressureSensorItem
{
[Display(Name = "Auftrag Nr")]
[Column("[APS].[AuftragNr]")]
public int? AuftragNr { get; set; }
[Display(Name = "Position Nr")]
[Column("[APS].[PositionNr]")]
public short? PosNr { get; set; }
[Display(Name = "Serial Nr")]
[Column("[APS].[SerienNr]")]
public int? SerialNr { get; set; }
[Display(Name = "Kundenserial Nr")]
[Column("[APS].[KundeneigeneSerienNr]")]
public string CustomerSerialNr { get; set; }
[Display(Name = "IdentNr")]
[Column("[ID].[IdentNr]")]
public int? IdentNr { get; set; }
[Display(Name = "PcbId")]
[Column("[CPSTR].[PcbId]")]
public int PcbId { get; set; }
[Display(Name = "Typ")]
[Column("[ID].[Typ]")]
public string TypeI { get; set; }
[Display(Name = "Zusatz")]
[Column("[ID].[Typzusatz]")]
public string TypeII { 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 = "AVG Pressure")]
[Column("[CPSTR].[AvgPressureInBar]")]
public float AVGPressure { get; set; }
[Display(Name = "Test passed")]
[Column("[CPSTR].[TestPassed]")]
public bool TestPassed { get; set; }
[Display(Name = "Test Date")]
[Column("[CPSTR].[TestDate]")]
public DateTime TestDate { get; set; }
}
}
@@ -0,0 +1,21 @@
namespace LaaProductionWeb.Services.Models.Reports
{
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
public class CordonelPressureSensorModel
{
public CordonelPressureSensorFilter Filter { get; set; }
= new CordonelPressureSensorFilter();
public IEnumerable<CordonelPressureSensorItem> Items { get; set; }
= Array.Empty<CordonelPressureSensorItem>();
public static implicit operator CordonelPressureSensorModel(CordonelPressureSensorFilter filter)
=> new CordonelPressureSensorModel { Filter = filter };
public string Display(Expression<Func<CordonelPressureSensorItem, object>> expression)
=> ReportModelExtensions.Display(expression);
}
}
@@ -9,9 +9,9 @@
this.Add(model.Text(x => x.FertigungsNr, this.Count));
this.Add(model.Text(x => x.SerialNr, this.Count));
this.Add(model.Text(x => x.PcbId, this.Count));
this.Add(model.Text(x => x.Typ, this.Count));
this.Add(model.Text(x => x.Nennweite, this.Count));
this.Add(model.Text(x => x.Baulaenge, this.Count));
this.Add(model.Text(x => x.Typ, this.Count));
this.Add(model.Text(x => x.StartDruck, this.Count));
this.Add(model.Text(x => x.EndDruck, this.Count));
this.Add(model.Text(x => x.DruckZeit, this.Count));
@@ -16,6 +16,72 @@
public ReportService(ISqlClient sqlClient)
=> this.sqlClient = sqlClient;
public CordonelPressureSensorModel LoadCordonelPressureSensorReport(CordonelPressureSensorModel model = null)
{
if (model is null)
{
model = new CordonelPressureSensorModel();
}
var where = model.Filter.Where();
var orderBy = model.Filter.OrderBy();
model.Items = this.sqlClient.ExecuteReader($@"
SELECT [APS].[AuftragNr] AS [AuftragNr]
, [APS].[PositionNr] AS [PosNr]
, [APS].[SerienNr] AS [SerialNr]
, [APS].[KundeneigeneSerienNr] AS [CustomerSerialNr]
, [ID].[IdentNr] AS [IdentNr]
, [CPSTR].[PcbId] AS [PcbId]
, [ID].[Typ] AS [TypeI]
, [ID].[Typzusatz] AS [TypeII]
, [ID].[Nennweite] AS [Nennweite]
, [ID].[Baulaenge] AS [Baulaenge]
, [CPSTR].[AvgPressureInBar] AS [AvgPressure]
, [CPSTR].[TestPassed] AS [TestPassed]
, [CPSTR].[TestDate] AS [TestDate]
FROM [Cordonel_PressureSensor_TestResults] AS [CPSTR]
LEFT JOIN [AuftragPositionSerienNr] AS [APS]
ON [APS].[FabNr] = [CPSTR].[PcbId]
LEFT JOIN [AuftragPosition_Gesamt] AS [APG]
ON [APG].[AuftragNr] = [APS].[AuftragNr]
AND [APG].[PositionNr] = [APS].[PositionNr]
LEFT JOIN [Identnr] AS [ID]
ON [ID].[IdentNr] = [APG].[Identnr]
WHERE {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 CordonelPressureSensorItem
{
AuftragNr = reader.GetValue<int?>(),
PosNr = reader.GetValue<short?>(),
SerialNr = reader.GetValue<int?>(),
CustomerSerialNr = reader.GetString(),
IdentNr = reader.GetValue<int?>(),
PcbId = reader.GetValue<int>(),
TypeI = reader.GetString(),
TypeII = reader.GetString(),
Nennweite = reader.GetValue<int?>(),
Baulaenge = reader.GetValue<int?>(),
AVGPressure = reader.GetValue<float>(),
TestPassed = reader.GetValue<bool>(),
TestDate = reader.GetValue<DateTime>(),
});
return model;
}
public HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null)
{
if (model is null)
@@ -75,5 +75,21 @@
return this.File(csvReport, "application/csv");
}
[HttpGet]
public ActionResult CordonelPressureSensor()
{
var model = this.reportService.LoadCordonelPressureSensorReport();
return this.View(model);
}
[HttpPost]
public ActionResult CordonelPressureSensor(CordonelPressureSensorModel model)
{
model = this.reportService.LoadCordonelPressureSensorReport(model);
return this.View(model);
}
}
}
@@ -190,6 +190,7 @@
<Content Include="Views\Report\Kottmann.cshtml" />
<Content Include="Views\Search\Wildcard.cshtml" />
<Content Include="Views\Shipments\Missing.cshtml" />
<Content Include="Views\Report\CordonelPressureSensor.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
@@ -0,0 +1,69 @@
@model CordonelPressureSensorModel
@using LaaProductionWeb.Services.Models.Reports
<form action="~/Report/Kottmann" method="post" autocomplete="off" class="h-100" id="cor_report">
<div class="table-responsive h-100 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.PosNr)</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.CustomerSerialNr)</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.PcbId)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.TypeI)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.TypeII)</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.AVGPressure)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.TestPassed)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.TestDate)</th>
</tr>
<tr>
@foreach (var filter in this.Model.Filter)
{
if (filter.Type == PropertyType.Date)
{
<td>@this.Html.Partial("DateFilter", filter)</td>
}
else
{
<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.PosNr</td>
<td class="text-nowrap p-2">@item.SerialNr</td>
<td class="text-nowrap p-2">@item.CustomerSerialNr</td>
<td class="text-nowrap p-2">@item.IdentNr</td>
<td class="text-nowrap p-2">@item.PcbId</td>
<td class="text-nowrap p-2">@item.TypeI</td>
<td class="text-nowrap p-2">@item.TypeII</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.AVGPressure</td>
<td class="text-nowrap p-2"><i class="bi bi-bold @(item.TestPassed ? "bi-check text-success" : "bi-x text-danger")"></i></td>
<td class="text-nowrap p-2">@($"{item.TestDate:dd.MM.yyyy}")</td>
</tr>
}
</tbody>
</table>
</div>
</form>
@section scripts {
<script>
let form = document.getElementById('cor_report');
let inputFields = form
.querySelectorAll('input')
.forEach(x => x.onchange = () => form.submit());
</script>
}
@@ -85,15 +85,15 @@
</button>
</form>
<button id="modal_btn" class="d-none" data-bs-toggle="modal" data-bs-target="#modal"></button>
<button id="modal_btn" class="d-none" data-bs-toggle="he_modal" data-bs-target="#he_modal"></button>
<!-- Modal -->
<div class="modal fade" id="modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal fade" id="he_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>
<button type="button" class="btn-close" data-bs-dismiss="he_modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table table-sm table-bordered">
@@ -119,10 +119,10 @@
.forEach(x => x.onchange = () => form.submit());
let tbody = this.document.getElementById('tbody');
let modal = this.document.getElementById('modal');
let heModal = this.document.getElementById('he_modal');
let modalBtn = this.document.getElementById('modal_btn');
modal.addEventListener('hide.bs.modal', x => this.location.hash = '');
heModal.addEventListener('hide.bs.modal', _ => this.location.hash = '');
window.addEventListener('hashchange', function () {
tbody.innerHTML = null;
@@ -2,7 +2,7 @@
@using LaaProductionWeb.Services.Models.Reports
<form action="~/Report/Helium" method="post" autocomplete="off" class="h-100" id="he_report">
<form action="~/Report/Kottmann" method="post" autocomplete="off" class="h-100" id="kot_report">
<div class="table-responsive h-100 mh-100">
<table class="table table-sm table-bordered mb-0">
<thead class="bg-light">
@@ -65,4 +65,35 @@
<button class="btn btn-light border-success" type="submit">
<i class="bi bi-filetype-csv text-success"></i>
</button>
</form>
</form>
@section scripts {
<script>
let form = document.getElementById('kot_report');
let inputFields = form
.querySelectorAll('input')
.forEach(x => x.onchange = () => form.submit());
@*let tbody = this.document.getElementById('tbody');
let modal = this.document.getElementById('modal');
let modalBtn = this.document.getElementById('modal_btn');
modal.addEventListener('hide.bs.modal', x => this.location.hash = '');
window.addEventListener('hashchange', function () {
tbody.innerHTML = null;
if (location.hash) {
let testId = location.hash.substring(1);
if (testId) {
fetch(`@this.Url.Action("HeliumResults", "Report")?testId=${testId}`)
.then(response => response.text())
.then(function (html) {
tbody.innerHTML = html;
modalBtn.click();
})
.catch(x => console.log(x));
}
}
});*@
</script>
}
@@ -46,6 +46,7 @@
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="~/Report/Helium">Helium</a></li>
<li><a class="dropdown-item" href="~/Report/Kottmann">Kottmann</a></li>
<li><a class="dropdown-item" href="~/Report/CordonelPressureSensor">Cordonel Pressure Sensor</a></li>
</ul>
</li>
}