This commit is contained in:
2023-07-27 12:37:24 -07:00
parent 0111a25e69
commit 9717fcb3bf
37 changed files with 425 additions and 43 deletions

View File

@ -68,7 +68,7 @@ public class TimedHostedService : IHostedService, IAggregateInputReader, IDispos
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{
_Logger.LogInformation($"Timed Hosted Service: {_AppSettings.GitCommitSeven}:{Environment.ProcessId} running.");
_Logger.LogInformation($"Timed Hosted Service: {_AppSettings.BuildSourceVersion}:{Environment.ProcessId} running.");
if (!string.IsNullOrEmpty(_AppSettings.SerialPortName))
_SerialService.Open();
#if Linux
@ -98,7 +98,7 @@ public class TimedHostedService : IHostedService, IAggregateInputReader, IDispos
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{
_Logger.LogInformation($"Timed Hosted Service: {_AppSettings.GitCommitSeven}:{Environment.ProcessId} is stopping.");
_Logger.LogInformation($"Timed Hosted Service: {_AppSettings.BuildSourceVersion}:{Environment.ProcessId} is stopping.");
for (short i = 0; i < short.MaxValue; i++)
{
Thread.Sleep(500);

View File

@ -3,6 +3,7 @@ using System.Text.Json;
namespace Barcode.Host.Server.Models;
public record AppSettings(string BuildNumber,
string BuildSourceVersion,
int ClearLastScanServiceAfter,
string Company,
string DeviceNameEndsWith,
@ -10,7 +11,6 @@ public record AppSettings(string BuildNumber,
int ExpectedScanLengthA,
int ExpectedScanLengthB,
string FileShare,
string GitCommitSeven,
bool IsDevelopment,
bool IsStaging,
string LinuxDevicePath,

View File

@ -9,6 +9,7 @@ public class AppSettings
#nullable disable
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
[Display(Name = "Build Source Version"), Required] public string BuildSourceVersion { get; set; }
[Display(Name = "Last Scan Service Clear After"), Required] public int? ClearLastScanServiceAfter { get; set; }
[Display(Name = "Company"), Required] public string Company { get; set; }
[Display(Name = "Device Name Ends With"), Required] public string DeviceNameEndsWith { get; set; }
@ -16,7 +17,6 @@ public class AppSettings
[Display(Name = "ExpectedScanLengthA"), Required] public int? ExpectedScanLengthA { get; set; }
[Display(Name = "ExpectedScanLengthB"), Required] public int? ExpectedScanLengthB { get; set; }
[Display(Name = "File Share"), Required] public string FileShare { get; set; }
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
[Display(Name = "Is Development"), Required] public bool? IsDevelopment { get; set; }
[Display(Name = "Is Staging"), Required] public bool? IsStaging { get; set; }
[Display(Name = "Linux Device Path"), Required] public string LinuxDevicePath { get; set; }
@ -62,8 +62,8 @@ public class AppSettings
throw new NullReferenceException(nameof(ExpectedScanLengthB));
if (appSettings.FileShare is null)
throw new NullReferenceException(nameof(FileShare));
if (appSettings.GitCommitSeven is null)
throw new NullReferenceException(nameof(GitCommitSeven));
if (appSettings.BuildSourceVersion is null)
throw new NullReferenceException(nameof(BuildSourceVersion));
if (appSettings.IsDevelopment is null)
throw new NullReferenceException(nameof(IsDevelopment));
if (appSettings.IsStaging is null)
@ -96,6 +96,7 @@ public class AppSettings
throw new NullReferenceException(nameof(WriteToSerialEvery));
result = new(
appSettings.BuildNumber,
appSettings.BuildSourceVersion,
appSettings.ClearLastScanServiceAfter.Value,
appSettings.Company,
appSettings.DeviceNameEndsWith,
@ -103,7 +104,6 @@ public class AppSettings
appSettings.ExpectedScanLengthA.Value,
appSettings.ExpectedScanLengthB.Value,
appSettings.FileShare,
appSettings.GitCommitSeven,
appSettings.IsDevelopment.Value,
appSettings.IsStaging.Value,
appSettings.LinuxDevicePath,

View File

@ -1,20 +1,59 @@
@page
@model NotificationModel
<div class="container">
<div class="row p-1">
<div class="col-6">
<h3 style="text-align:center"></h3>
</div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="row p-1">
<div class="col-6">
<h1 style="text-align:center">Scan RDS barcode before starting BioRad</h1>
</div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="row p-1">
<div class="col-6">
<h1 id="lastScanServiceResultValue" style="text-align:center"></h1>
</div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="row p-1">
<div class="col-6">
<h1 id="mId" style="text-align:center"></h1>
</div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="row p-1">
<div class="col-6">
<h1 id="recipe" style="text-align:center"></h1>
</div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="row p-1">
<div class="col-6">
<h1 id="httpContentBody" style="text-align:center"></h1>
</div>
</div>
</div>
<script src="~/js/signalr/dist/browser/signalr.js"></script>
<script src="~/js/notification.js"></script>
<script>
var appSettings = JSON.parse('@(System.Text.Json.JsonSerializer.Serialize(this.Model.AppSettings))');
console.log(appSettings.BuildSourceVersion);
console.log(appSettings.BuildNumber);
console.log(appSettings);
</script>
<script src="~/js/signalr/dist/browser/signalr.js?dateTime=2023-07-26---12-08-00"></script>
<script src="~/js/notification.js?dateTime=2023-07-26---12-08-00"></script>

View File

@ -1,16 +1,22 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Barcode.Host.Server.Models;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Barcode.Host.Server.Pages;
public class NotificationModel : PageModel
{
public AppSettings AppSettings { get; }
private readonly ILogger<NotificationModel> _Logger;
public NotificationModel(ILogger<NotificationModel> logger) =>
public NotificationModel(ILogger<NotificationModel> logger, AppSettings appSettings)
{
_Logger = logger;
AppSettings = appSettings;
}
public void OnGet()
{
}
}

View File

@ -17,7 +17,8 @@ a {
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
@ -31,7 +32,7 @@ a {
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
}
button.accept-policy {

View File

@ -8,8 +8,14 @@ html {
}
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
box-shadow:
0 0 0 0.1rem white,
0 0 0 0.25rem #258cfb;
}
html {
@ -19,4 +25,4 @@ html {
body {
margin-bottom: 60px;
}
}

View File

@ -1,19 +1,56 @@
"use strict";
var connection = new signalR.HubConnectionBuilder().withUrl("/NotificationHub").build();
var connection = new signalR.HubConnectionBuilder()
.withUrl("/NotificationHub")
.build();
connection.on("NotifyAll", function (data) {
if (data.keyPressEvent && data.lastScanServiceResultValue) {
var innerText = `${data.keyPressEvent.dateTime} - [${data.lastScanServiceResultValue}]`;
document.getElementById("lastScanServiceResultValue").innerText = innerText;
if (!data.keyPressEvent || !data.lastScanServiceResultValue) {
if (!data.httpContentBody) {
document.getElementById("lastScanServiceResultValue").innerText = "";
}
else if (data.httpContentBody) {
var innerText = `${data.httpContentBody}]`; //JSON.parse() // JSON.stringify()
document.getElementById("httpContentBody").innerText = innerText;
} else {
var innerText = `${data.keyPressEvent.dateTime} - [${data.lastScanServiceResultValue}]`;
document.getElementById("lastScanServiceResultValue").innerText = innerText;
}
if (!data.httpContentBody) {
if (!data.keyPressEvent || !data.lastScanServiceResultValue) {
document.getElementById("httpContentBody").innerText = data;
document.getElementById("mId").innerText = "";
document.getElementById("recipe").innerText = "";
}
} else {
document.getElementById("httpContentBody").innerText = data.httpContentBody;
var postResult = JSON.parse(data.httpContentBody);
if (!postResult.MId) {
document.getElementById("mId").innerText = "";
} else {
document.getElementById(
"mId",
).innerText = `Use ${postResult.MId} for the wafer and input id`;
}
if (!postResult.Recipe) {
document.getElementById("recipe").innerText = "";
} else {
if (postResult.Recipe != "Recipe") {
document.getElementById("recipe").innerText = postResult.Recipe;
} else {
$.getJSON(
"https://oi-prod-ec-api.mes.infineon.com/api/oiWizard/materials/rds/" +
postResult.LotName,
function (data) {
document.getElementById("recipe").innerText =
data.rds.rdsLayers.length;
},
);
}
}
}
});
connection.start().then(function () {
}).catch(function (err) {
connection
.start()
.then(function () {})
.catch(function (err) {
return console.error(err.toString());
});
});