Spreading Resistance Profile with ChartJS,
Copy-On-Get and nuget bump (Serilog)
This commit is contained in:
@ -80,13 +80,14 @@ dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array al
|
|||||||
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
|
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
|
||||||
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
||||||
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||||
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
|
||||||
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||||
|
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||||
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||||
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
||||||
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
||||||
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
||||||
|
dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||||
|
7
.vscode/thunder-tests/thunderCollection.json
vendored
7
.vscode/thunder-tests/thunderCollection.json
vendored
@ -19,5 +19,12 @@
|
|||||||
"created": "2023-03-08T17:31:19.468Z",
|
"created": "2023-03-08T17:31:19.468Z",
|
||||||
"sortNum": 30000,
|
"sortNum": 30000,
|
||||||
"folders": []
|
"folders": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "9ebfb84d-fa73-4c00-a2e0-e9ec69a31a16",
|
||||||
|
"colName": "LocalHost",
|
||||||
|
"created": "2023-05-08T19:34:00.425Z",
|
||||||
|
"sortNum": 40000,
|
||||||
|
"folders": []
|
||||||
}
|
}
|
||||||
]
|
]
|
19
.vscode/thunder-tests/thunderclient.json
vendored
19
.vscode/thunder-tests/thunderclient.json
vendored
@ -417,5 +417,24 @@
|
|||||||
"form": []
|
"form": []
|
||||||
},
|
},
|
||||||
"tests": []
|
"tests": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "524e5261-69eb-4888-8818-608cde1ce506",
|
||||||
|
"colId": "9ebfb84d-fa73-4c00-a2e0-e9ec69a31a16",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "Inbound-SRP",
|
||||||
|
"url": "http://localhost:5126/api/inbound/SRP",
|
||||||
|
"method": "POST",
|
||||||
|
"sortNum": 10000,
|
||||||
|
"created": "2023-05-08T19:34:14.843Z",
|
||||||
|
"modified": "2023-05-08T19:50:20.646Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "json",
|
||||||
|
"raw": "{\n \"SentToMetrology\": false,\n \"SentToSPC\": false,\n \"Id\": 0,\n \"Batch\": \"BIORAD#2\",\n \"Cassette\": \"BIORAD2\",\n \"CellName\": \"BIORAD2\",\n \"Date\": \"05/08/2023 12:23:23 AM\",\n \"FilePath\": \"\",\n \"Layer\": \"1\",\n \"MeanThickness\": \"21.8224\",\n \"Op\": \"C\",\n \"PSN\": \"5010\",\n \"PassFail\": \"PASS\",\n \"RDS\": \"588252\",\n \"RVThickness\": \"2.0559\",\n \"Reactor\": \"23\",\n \"Recipe\": \"PROD_8inch\",\n \"StdDev\": \"0.1483\",\n \"Title\": \"Bio-RadQS400MEPI\",\n \"UniqueId\": \"Bio-RadQS400MEPI_23-588252-5010.1_202305080023237034_5.4661928_Point-1\",\n \"Wafer\": \"23-588252-5010.1\",\n \"Zone\": \"-\",\n \"Details\": []\n}",
|
||||||
|
"form": []
|
||||||
|
},
|
||||||
|
"tests": []
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -35,9 +35,9 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
1
Server/.vscode/format-report.json
vendored
Normal file
1
Server/.vscode/format-report.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
@ -0,0 +1,38 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using OI.Metrology.Shared.Services;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.ApiControllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public partial class SpreadingResistanceProfileController : ControllerBase, ISpreadingResistanceProfileController<IActionResult>
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IAttachmentsService _AttachmentsService;
|
||||||
|
private readonly IMetrologyRepository _MetrologyRepository;
|
||||||
|
private readonly IToolTypesRepository _ToolTypesRepository;
|
||||||
|
private readonly ISpreadingResistanceProfileService _SpreadingResistanceProfileService;
|
||||||
|
|
||||||
|
public SpreadingResistanceProfileController(IMetrologyRepository metrologyRepository, IAttachmentsService attachmentsService, IToolTypesRepository toolTypesRepository, ISpreadingResistanceProfileService spreadingResistanceProfileService)
|
||||||
|
{
|
||||||
|
_MetrologyRepository = metrologyRepository;
|
||||||
|
_AttachmentsService = attachmentsService;
|
||||||
|
_ToolTypesRepository = toolTypesRepository;
|
||||||
|
_SpreadingResistanceProfileService = spreadingResistanceProfileService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("{toolTypeId}/{tabletype}/files/{attachmentId}/{filename}")]
|
||||||
|
public IActionResult GetAttachment(int toolTypeId, string tabletype, string attachmentId, string filename)
|
||||||
|
{
|
||||||
|
(string? message, string? contenttype, Stream? stream) = _ToolTypesRepository.GetAttachment(_MetrologyRepository, _AttachmentsService, toolTypeId, tabletype, attachmentId, filename);
|
||||||
|
if (message is not null)
|
||||||
|
return Content(message);
|
||||||
|
else if (contenttype is not null && stream is not null)
|
||||||
|
return File(_SpreadingResistanceProfileService.GetImageBytes(stream), "image/jpeg");
|
||||||
|
else
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -37,12 +37,13 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||||
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
|
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
|
||||||
|
@ -73,6 +73,7 @@ public class Program
|
|||||||
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>(_ => new(appSettings.MockRoot));
|
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>(_ => new(appSettings.MockRoot));
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
|
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>(_ => new(appSettings.MockRoot));
|
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>(_ => new(appSettings.MockRoot));
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<ISpreadingResistanceProfileService, SpreadingResistanceProfileService>();
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
|
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
||||||
|
@ -314,13 +314,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal DataTable GetHeaders(int toolTypeId, DateTime? startTime, DateTime? endTime, int? pageNo, int? pageSize, long? headerId, out long totalRecords)
|
internal DataTable GetHeaders(int toolTypeId, DateTime? startTime, DateTime? endTime, int? pageNo, int? pageSize, long? headerId, out long totalRecords)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||||
if (md is null)
|
|
||||||
throw new Exception("Invalid tool type metadata");
|
|
||||||
|
|
||||||
DataTable dt = new();
|
DataTable dt = new();
|
||||||
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
||||||
@ -407,13 +403,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal DataTable GetData(int toolTypeId, long headerid)
|
internal DataTable GetData(int toolTypeId, long headerid)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||||
if (md is null)
|
|
||||||
throw new Exception("Invalid tool type metadata");
|
|
||||||
|
|
||||||
DataTable dt = new();
|
DataTable dt = new();
|
||||||
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
||||||
@ -502,9 +494,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal Guid GetHeaderAttachmentID(int toolTypeId, long headerId)
|
internal Guid GetHeaderAttachmentID(int toolTypeId, long headerId)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
@ -514,9 +504,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
}
|
}
|
||||||
internal string GetHeaderInsertDate(int toolTypeId, long headerId)
|
internal string GetHeaderInsertDate(int toolTypeId, long headerId)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
@ -546,9 +534,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal Guid GetDataAttachmentID(int toolTypeId, long headerId, string title)
|
internal Guid GetDataAttachmentID(int toolTypeId, long headerId, string title)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
@ -559,9 +545,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
// J Ouellette Added
|
// J Ouellette Added
|
||||||
internal string GetDataInsertDate(int toolTypeId, long headerId, string title)
|
internal string GetDataInsertDate(int toolTypeId, long headerId, string title)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
string sql = "";
|
string sql = "";
|
||||||
@ -592,9 +576,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal DataSet GetOIExportData(int toolTypeId, long headerid)
|
internal DataSet GetOIExportData(int toolTypeId, long headerid)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(tt.OIExportSPName))
|
if (string.IsNullOrWhiteSpace(tt.OIExportSPName))
|
||||||
throw new Exception("OpenInsight export not available for " + tt.ToolTypeName);
|
throw new Exception("OpenInsight export not available for " + tt.ToolTypeName);
|
||||||
@ -657,9 +639,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId.Value);
|
ToolType tt = GetToolTypeByID(toolTypeId.Value) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
string sql = $"SELECT ID, InsertDate, AttachmentID, Title, [Date], {tt.ID} AS ToolTypeID, '{tt.ToolTypeName}' AS ToolTypeName, Reactor, RDS, PSN FROM {tt.HeaderTableName} ORDER BY [Date] DESC ";
|
string sql = $"SELECT ID, InsertDate, AttachmentID, Title, [Date], {tt.ID} AS ToolTypeID, '{tt.ToolTypeName}' AS ToolTypeName, Reactor, RDS, PSN FROM {tt.HeaderTableName} ORDER BY [Date] DESC ";
|
||||||
@ -684,13 +664,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal IEnumerable<KeyValuePair<string, string>> GetHeaderFields(int toolTypeId, long headerid)
|
internal IEnumerable<KeyValuePair<string, string>> GetHeaderFields(int toolTypeId, long headerid)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||||
if (md is null)
|
|
||||||
throw new Exception("Invalid tool type metadata");
|
|
||||||
|
|
||||||
List<KeyValuePair<string, string>> r = new();
|
List<KeyValuePair<string, string>> r = new();
|
||||||
|
|
||||||
@ -749,9 +725,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
|
internal int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
if (clearDate)
|
if (clearDate)
|
||||||
@ -771,9 +745,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal Guid GetHeaderAttachmentIDByTitle(int toolTypeId, string title)
|
internal Guid GetHeaderAttachmentIDByTitle(int toolTypeId, string title)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
@ -783,9 +755,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
internal Guid GetDataAttachmentIDByTitle(int toolTypeId, string title)
|
internal Guid GetDataAttachmentIDByTitle(int toolTypeId, string title)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||||
if (tt is null)
|
|
||||||
throw new Exception("Invalid tool type ID");
|
|
||||||
|
|
||||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
|
@ -179,7 +179,8 @@ public class ToolTypesRepository : IToolTypesRepository
|
|||||||
Stream? stream = null;
|
Stream? stream = null;
|
||||||
string? message = null;
|
string? message = null;
|
||||||
Guid attachmentIdParsed;
|
Guid attachmentIdParsed;
|
||||||
string? contenttype = null;
|
string? contentType = null;
|
||||||
|
string filenameLowerThenTrim = filename.ToLower().TrimEnd();
|
||||||
ToolType tt = metrologyRepository.GetToolTypeByID(toolTypeId);
|
ToolType tt = metrologyRepository.GetToolTypeByID(toolTypeId);
|
||||||
bool header = !string.Equals(tabletype.Trim(), "data", StringComparison.OrdinalIgnoreCase);
|
bool header = !string.Equals(tabletype.Trim(), "data", StringComparison.OrdinalIgnoreCase);
|
||||||
if (!Guid.TryParse(attachmentId, out attachmentIdParsed))
|
if (!Guid.TryParse(attachmentId, out attachmentIdParsed))
|
||||||
@ -189,15 +190,18 @@ public class ToolTypesRepository : IToolTypesRepository
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// figure out what content type to use. this is very simple because there are only two types being used
|
// figure out what content type to use. this is very simple because there are only two types being used
|
||||||
contenttype = "application/pdf";
|
if (filenameLowerThenTrim.EndsWith(".txt"))
|
||||||
if (filename.ToLower().TrimEnd().EndsWith(".txt"))
|
contentType = "text/plain";
|
||||||
contenttype = "text/plain";
|
else if (filenameLowerThenTrim.EndsWith(".json"))
|
||||||
|
contentType = "application/json";
|
||||||
|
else
|
||||||
|
contentType = "application/pdf";
|
||||||
// Get attachment stream and feed it to the client
|
// Get attachment stream and feed it to the client
|
||||||
stream = attachmentsService.GetAttachmentStreamByAttachmentId(tt, header, attachmentIdParsed, filename);
|
stream = attachmentsService.GetAttachmentStreamByAttachmentId(tt, header, attachmentIdParsed, filename);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { message = ex.Message; }
|
catch (Exception ex) { message = ex.Message; }
|
||||||
}
|
}
|
||||||
return new(message, contenttype, stream);
|
return new(message, contentType, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This endpoint triggers writing of the OI Export file
|
// This endpoint triggers writing of the OI Export file
|
||||||
|
300
Server/Services/SpreadingResistanceProfileService.cs
Normal file
300
Server/Services/SpreadingResistanceProfileService.cs
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
using Adaptation.FileHandlers.json;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.Services;
|
||||||
|
|
||||||
|
public class SpreadingResistanceProfileService : ISpreadingResistanceProfileService
|
||||||
|
{
|
||||||
|
|
||||||
|
#pragma warning disable CA1416
|
||||||
|
|
||||||
|
private static RectangleF GetRectangleF(double left, double top, double width, double height) =>
|
||||||
|
new((float)left, (float)top, (float)width, (float)height);
|
||||||
|
|
||||||
|
private static void DrawLine(Graphics graphics, Pen pen, double x1, double y1, double x2, double y2) =>
|
||||||
|
graphics.DrawLine(pen, (float)x1, (float)y1, (float)x2, (float)y2);
|
||||||
|
|
||||||
|
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y) =>
|
||||||
|
graphics.DrawString(s, font, brush, (float)x, (float)y);
|
||||||
|
|
||||||
|
private static void FillEllipse(Graphics graphics, Brush brush, double x, double y, double width, double height) =>
|
||||||
|
graphics.FillEllipse(brush, (float)x, (float)y, (float)width, (float)height);
|
||||||
|
|
||||||
|
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y, StringFormat stringFormat) =>
|
||||||
|
graphics.DrawString(s, font, brush, (float)x, (float)y, stringFormat);
|
||||||
|
|
||||||
|
private static void GetMinMax(List<ProfilePoint> profilePoints, out double decades, out double maxDepth, out double concentrationMin, out double resistanceEditedMin, out double resistivityMin)
|
||||||
|
{
|
||||||
|
double ceilingCD;
|
||||||
|
double ceilingEdited;
|
||||||
|
maxDepth = int.MinValue;
|
||||||
|
double ceilingResistivity;
|
||||||
|
resistivityMin = double.MaxValue;
|
||||||
|
concentrationMin = double.MaxValue;
|
||||||
|
resistanceEditedMin = double.MaxValue;
|
||||||
|
double resistivityMax = double.MinValue;
|
||||||
|
double concentrationMax = double.MinValue;
|
||||||
|
double resistanceEditedMax = double.MinValue;
|
||||||
|
foreach (ProfilePoint profilePoint in profilePoints)
|
||||||
|
{
|
||||||
|
if (profilePoint.Log10?.ResistanceEdited is null || profilePoint.Log10?.Resistivity is null || profilePoint.Log10?.Concentration is null)
|
||||||
|
continue;
|
||||||
|
if (profilePoint.Depth <= 0 || profilePoint.ResistanceRaw == 0)
|
||||||
|
continue;
|
||||||
|
maxDepth = profilePoint.Depth;
|
||||||
|
if (profilePoint.Log10.Resistivity.Value < resistivityMin)
|
||||||
|
resistivityMin = profilePoint.Log10.Resistivity.Value;
|
||||||
|
ceilingResistivity = Math.Ceiling(profilePoint.Log10.Resistivity.Value);
|
||||||
|
if (ceilingResistivity > resistivityMax)
|
||||||
|
resistivityMax = ceilingResistivity;
|
||||||
|
if (profilePoint.Log10.ResistanceEdited.Value < resistanceEditedMin)
|
||||||
|
resistanceEditedMin = profilePoint.Log10.ResistanceEdited.Value;
|
||||||
|
ceilingEdited = Math.Ceiling(profilePoint.Log10.ResistanceEdited.Value);
|
||||||
|
if (ceilingEdited > resistanceEditedMax)
|
||||||
|
resistanceEditedMax = ceilingEdited;
|
||||||
|
if (profilePoint.Log10.Concentration.Value < concentrationMin)
|
||||||
|
concentrationMin = profilePoint.Log10.Concentration.Value;
|
||||||
|
ceilingCD = Math.Ceiling(profilePoint.Log10.Concentration.Value);
|
||||||
|
if (ceilingCD > concentrationMax)
|
||||||
|
concentrationMax = ceilingCD;
|
||||||
|
}
|
||||||
|
decades = resistivityMax - resistivityMin;
|
||||||
|
if (resistanceEditedMax - resistanceEditedMin > decades)
|
||||||
|
decades = resistanceEditedMax - resistanceEditedMin;
|
||||||
|
if (concentrationMax - concentrationMin > decades)
|
||||||
|
decades = concentrationMax - concentrationMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RectangleF[] GetRectangles(double leftChartArea, double widthChartArea, double topChartArea, double sizeOfBlock, double widthOfBlacks)
|
||||||
|
{
|
||||||
|
List<RectangleF> rectangles = new()
|
||||||
|
{
|
||||||
|
GetRectangleF(leftChartArea, 10, widthChartArea, 65),
|
||||||
|
// GetRectangleF(leftChartArea + widthChartArea, topChartArea, widthOfBlacks, sizeOfBlock * 5);
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 0, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 1, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 2, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 3, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 4, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 5, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 6, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 7, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 8, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 9, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 10, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 11, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 12, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 13, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 14, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 15, widthOfBlacks, sizeOfBlock),
|
||||||
|
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 16, widthOfBlacks, sizeOfBlock * 2)
|
||||||
|
};
|
||||||
|
return rectangles.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string[] GetRectanglesDescriptions(Info info, Setup setup, List<Layer> layers)
|
||||||
|
{
|
||||||
|
List<string> results = new()
|
||||||
|
{
|
||||||
|
string.Empty, // 0
|
||||||
|
string.Empty, // 1
|
||||||
|
string.Empty, // 2
|
||||||
|
string.Empty, // 3
|
||||||
|
string.Empty, // 4
|
||||||
|
string.Empty, // 5
|
||||||
|
string.Empty, // 6
|
||||||
|
string.Empty, // 7
|
||||||
|
string.Empty, // 8
|
||||||
|
string.Concat(info.SystemId, Environment.NewLine, info.SoftwareVersion), // 9
|
||||||
|
string.Concat("SURFACE FINISH", Environment.NewLine, setup.Finish), // 10
|
||||||
|
string.Concat("ORIENTATION", Environment.NewLine, setup.Orientation), // 11
|
||||||
|
string.Concat("BEVEL ANGLE", Environment.NewLine, setup.SineBevelAngle), // 12
|
||||||
|
string.Concat("X-STEP (um)", Environment.NewLine, setup.Steps.First().X), // 13
|
||||||
|
string.Concat("PROBE LOAD (gm)", Environment.NewLine, setup.ProbeLoad), // 14
|
||||||
|
string.Concat("SPACING (um)", Environment.NewLine, setup.ProbeSpacing), // 15
|
||||||
|
string.Concat("OPERATOR", Environment.NewLine, info.Operator), // 16
|
||||||
|
string.Concat("DATE", Environment.NewLine, info.DateTime.ToString("dd MMM yy"), Environment.NewLine, "TIME", Environment.NewLine, info.DateTime.ToString("HH:mm:ss tt")), // 17
|
||||||
|
};
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
foreach (Layer layer in layers)
|
||||||
|
_ = stringBuilder.AppendLine(string.Concat("First Pt. ", layer.FirstPoint, " Last Pt. ", layer.LastPoint, " Type ", layer.Type, " Smoothing ", layer.Smoothing, " Correction ", layer.Correction));
|
||||||
|
_ = stringBuilder.AppendLine(string.Join(" ", info.Comments));
|
||||||
|
results[0] = stringBuilder.ToString();
|
||||||
|
return results.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static byte[] GetImageBytes(CSV csv)
|
||||||
|
{
|
||||||
|
if (csv.Info is null)
|
||||||
|
throw new NullReferenceException(nameof(csv.Info));
|
||||||
|
if (csv.Setup is null)
|
||||||
|
throw new NullReferenceException(nameof(csv.Setup));
|
||||||
|
if (csv.LayerHeader is null)
|
||||||
|
throw new NullReferenceException(nameof(csv.LayerHeader));
|
||||||
|
if (csv.ProfileHeader is null)
|
||||||
|
throw new NullReferenceException(nameof(csv.ProfileHeader));
|
||||||
|
|
||||||
|
double decades, maxDepth, concentrationMin, resistanceEditedMin, resistivityMin;
|
||||||
|
GetMinMax(csv.ProfileHeader.ProfilePoints, out decades, out maxDepth, out concentrationMin, out resistanceEditedMin, out resistivityMin);
|
||||||
|
|
||||||
|
byte[] bytes;
|
||||||
|
int penSize = 1;
|
||||||
|
int width = 694;
|
||||||
|
int height = 714;
|
||||||
|
int ellipseSize = 3;
|
||||||
|
Pen pen = Pens.Black;
|
||||||
|
int blocksOfDepth = 6;
|
||||||
|
RectangleF[] rectangles;
|
||||||
|
double topChartArea = 90;
|
||||||
|
double leftChartArea = 60;
|
||||||
|
double widthOfBlacks = 120;
|
||||||
|
Brush brush = Brushes.Black;
|
||||||
|
double widthChartArea = 500;
|
||||||
|
double heightChartArea = 600;
|
||||||
|
Font consolas = new("Consolas", 9);
|
||||||
|
Color backgroundColor = Color.White;
|
||||||
|
Brush resistivityBrush = Brushes.Green;
|
||||||
|
Font consolasBold = new("Consolas", 9);
|
||||||
|
Brush concentrationBrush = Brushes.Blue;
|
||||||
|
Brush resistanceRawBrush = Brushes.Black;
|
||||||
|
Brush resistanceEditedBrush = Brushes.Red;
|
||||||
|
double sizeOfBlock = heightChartArea / 18;
|
||||||
|
Brush backgroundBrush = Brushes.WhiteSmoke;
|
||||||
|
Pen resistivityPen = new(Color.Green, penSize);
|
||||||
|
Pen concentrationPen = new(Color.Blue, penSize);
|
||||||
|
Pen resistanceRawPen = new(Color.Black, penSize);
|
||||||
|
Pen resistanceEditedPen = new(Color.Red, penSize);
|
||||||
|
double widthOfDepthBlock = Math.Ceiling(maxDepth / 3) * 3 / 6;
|
||||||
|
StringFormat stringFormat = new() { Alignment = StringAlignment.Far };
|
||||||
|
|
||||||
|
Bitmap bitmap = new(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
|
Graphics graphics = Graphics.FromImage(bitmap);
|
||||||
|
graphics.Clear(backgroundColor);
|
||||||
|
|
||||||
|
rectangles = new RectangleF[1];
|
||||||
|
rectangles[0] = GetRectangleF(leftChartArea, topChartArea, widthChartArea, heightChartArea);
|
||||||
|
graphics.FillRectangles(backgroundBrush, rectangles);
|
||||||
|
|
||||||
|
rectangles = GetRectangles(leftChartArea, widthChartArea, topChartArea, sizeOfBlock, widthOfBlacks);
|
||||||
|
graphics.FillRectangles(Brushes.White, rectangles);
|
||||||
|
graphics.DrawRectangles(pen, rectangles);
|
||||||
|
|
||||||
|
string[] descriptions = GetRectanglesDescriptions(csv.Info, csv.Setup, csv.LayerHeader.Layers);
|
||||||
|
for (int i = 0; i < descriptions.Length; i++)
|
||||||
|
graphics.DrawString(descriptions[i], consolas, brush, rectangles[i]);
|
||||||
|
|
||||||
|
DrawLine(graphics, concentrationPen, 13, 6, 13, 40);
|
||||||
|
graphics.DrawString("C", consolasBold, concentrationBrush, 8, 41);
|
||||||
|
graphics.DrawString("D", consolasBold, concentrationBrush, 8, 53);
|
||||||
|
DrawLine(graphics, resistivityPen, 28, 6, 28, 40);
|
||||||
|
graphics.DrawString("ρ", consolasBold, resistivityBrush, 21, 41);
|
||||||
|
graphics.DrawString("c", consolasBold, resistivityBrush, 21, 53);
|
||||||
|
graphics.DrawString("m", consolasBold, resistivityBrush, 21, 62);
|
||||||
|
DrawLine(graphics, resistanceRawPen, 39, 7, 39, 41);
|
||||||
|
graphics.DrawString("Ω", consolasBold, resistanceRawBrush, 34, 41);
|
||||||
|
DrawLine(graphics, resistanceEditedPen, 51, 7, 51, 41);
|
||||||
|
graphics.DrawString("Ω", consolasBold, resistanceEditedBrush, 46, 41);
|
||||||
|
graphics.DrawString("E", consolasBold, resistanceEditedBrush, 46, 53);
|
||||||
|
|
||||||
|
for (double i = decades; i >= 0; i += -1)
|
||||||
|
{
|
||||||
|
for (int j = 1; j <= 10; j++)
|
||||||
|
DrawLine(graphics, Pens.LightGray, leftChartArea, topChartArea + heightChartArea - (i * heightChartArea / decades) + heightChartArea / decades * Math.Log10(j), leftChartArea + widthChartArea, topChartArea + heightChartArea - (i * heightChartArea / decades) + heightChartArea / decades * Math.Log10(j));
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawString(graphics, "0", consolas, brush, leftChartArea - 6, topChartArea + heightChartArea + 5);
|
||||||
|
|
||||||
|
double x, x1, x2;
|
||||||
|
for (int i = 0; i <= blocksOfDepth - 1; i++)
|
||||||
|
{
|
||||||
|
for (int j = 1; j <= 10; j++)
|
||||||
|
{
|
||||||
|
x = leftChartArea + 13 + (i + 1) * widthChartArea / blocksOfDepth;
|
||||||
|
x1 = leftChartArea + (i * widthChartArea / blocksOfDepth) + j * widthChartArea / blocksOfDepth / 10;
|
||||||
|
x2 = leftChartArea + (i * widthChartArea / blocksOfDepth) + (j * widthChartArea / blocksOfDepth / 10);
|
||||||
|
DrawLine(graphics, Pens.LightGray, x1, topChartArea, x2, topChartArea + heightChartArea);
|
||||||
|
DrawString(graphics, ((i + 1) * widthOfDepthBlock).ToString("0.0"), consolas, brush, x, topChartArea + heightChartArea + 5, stringFormat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DrawString(graphics, "(um)", consolas, brush, leftChartArea + widthChartArea + 12, topChartArea + heightChartArea + 5);
|
||||||
|
|
||||||
|
for (int i = 0; i <= decades; i++)
|
||||||
|
{
|
||||||
|
DrawLine(graphics, pen, leftChartArea, topChartArea + (i * heightChartArea / decades), leftChartArea + widthChartArea, topChartArea + (i * heightChartArea / decades));
|
||||||
|
DrawString(graphics, (decades - i + resistivityMin).ToString("0"), consolasBold, resistivityBrush, 33, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||||
|
DrawString(graphics, (decades - i + concentrationMin).ToString("0"), consolasBold, concentrationBrush, 20, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||||
|
DrawString(graphics, (decades - i + resistanceEditedMin).ToString("0"), consolasBold, resistanceRawBrush, 45, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||||
|
DrawString(graphics, (decades - i + resistanceEditedMin).ToString("0"), consolasBold, resistanceEditedBrush, 58, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||||
|
}
|
||||||
|
for (int i = 0; i <= blocksOfDepth; i++)
|
||||||
|
DrawLine(graphics, pen, leftChartArea + (i * widthChartArea / blocksOfDepth), topChartArea, leftChartArea + (i * widthChartArea / blocksOfDepth), topChartArea + heightChartArea);
|
||||||
|
double y, y2;
|
||||||
|
foreach (ProfilePoint profilePoint in csv.ProfileHeader.ProfilePoints)
|
||||||
|
{
|
||||||
|
if (profilePoint.Log10?.ResistanceEdited is null || profilePoint.Log10?.Resistivity is null || profilePoint.Log10?.Concentration is null)
|
||||||
|
continue;
|
||||||
|
if (profilePoint.Depth <= 0 || profilePoint.ResistanceRaw == 0)
|
||||||
|
continue;
|
||||||
|
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||||
|
x = leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - ellipseSize;
|
||||||
|
FillEllipse(graphics, concentrationBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||||
|
FillEllipse(graphics, resistanceRawBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||||
|
FillEllipse(graphics, resistivityBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||||
|
FillEllipse(graphics, resistanceEditedBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||||
|
if (profilePoint.LastProfilePoint?.ResistanceEdited is not null && profilePoint.LastProfilePoint?.Resistivity is not null && profilePoint.LastProfilePoint?.Concentration is not null && profilePoint.LastProfilePoint?.Log10?.ResistanceEdited is not null && profilePoint.LastProfilePoint?.Log10?.Resistivity is not null && profilePoint.LastProfilePoint?.Log10?.Concentration is not null && profilePoint.DeltaPercent is not null && profilePoint.DeltaPercent is >= .2 or <= -.2)
|
||||||
|
{
|
||||||
|
x = leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - penSize;
|
||||||
|
x2 = leftChartArea + profilePoint.LastProfilePoint.Depth / maxDepth * widthChartArea - penSize;
|
||||||
|
y = topChartArea + heightChartArea - ((profilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - penSize;
|
||||||
|
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - penSize;
|
||||||
|
DrawLine(graphics, concentrationPen, x, y, x2, y2);
|
||||||
|
y = topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||||
|
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||||
|
DrawLine(graphics, resistanceRawPen, x, y, x2, y2);
|
||||||
|
y = topChartArea + heightChartArea - ((profilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - penSize;
|
||||||
|
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - penSize;
|
||||||
|
DrawLine(graphics, resistivityPen, x, y, x2, y2);
|
||||||
|
y = topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||||
|
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||||
|
DrawLine(graphics, resistanceEditedPen, x, y, x2, y2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using MemoryStream msMemoryStream = new();
|
||||||
|
bitmap.Save(msMemoryStream, System.Drawing.Imaging.ImageFormat.Png);
|
||||||
|
bytes = new byte[Convert.ToInt32(msMemoryStream.Length) + 1];
|
||||||
|
_ = msMemoryStream.Read(bytes, 0, bytes.Length);
|
||||||
|
bytes = msMemoryStream.ToArray();
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] GetImageBytes(string json)
|
||||||
|
{
|
||||||
|
byte[] results;
|
||||||
|
Adaptation.FileHandlers.csv.CSV? csv = JsonSerializer.Deserialize<Adaptation.FileHandlers.csv.CSV>(json);
|
||||||
|
if (csv is null)
|
||||||
|
throw new NullReferenceException(nameof(csv));
|
||||||
|
CSV result = new(csv);
|
||||||
|
results = GetImageBytes(result);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] ISpreadingResistanceProfileService.GetImageBytes(string json)
|
||||||
|
{
|
||||||
|
byte[] results = GetImageBytes(json);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] ISpreadingResistanceProfileService.GetImageBytes(Stream stream)
|
||||||
|
{
|
||||||
|
byte[] results;
|
||||||
|
using StreamReader streamReader = new(stream, Encoding.UTF8);
|
||||||
|
string json = streamReader.ReadToEnd();
|
||||||
|
results = GetImageBytes(json);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
85
Server/Services/csv/CSV.cs
Normal file
85
Server/Services/csv/CSV.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class CSV
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable CA1834
|
||||||
|
|
||||||
|
public string? FileVersion { get; set; }
|
||||||
|
public Info? Info { get; set; }
|
||||||
|
public Setup? Setup { get; set; }
|
||||||
|
public LayerHeader? LayerHeader { get; set; }
|
||||||
|
public ProfileHeader? ProfileHeader { get; set; }
|
||||||
|
public Calibration? Calibration { get; set; }
|
||||||
|
public RawData? RawData { get; set; }
|
||||||
|
|
||||||
|
internal static CSV GetCSV(string path)
|
||||||
|
{
|
||||||
|
CSV result;
|
||||||
|
int? endInfo = null;
|
||||||
|
int? endSetup = null;
|
||||||
|
int? endLayers = null;
|
||||||
|
int? startInfo = null;
|
||||||
|
int? startSetup = null;
|
||||||
|
int? endProfiles = null;
|
||||||
|
int? startLayers = null;
|
||||||
|
int? startRawData = null;
|
||||||
|
int? startProfiles = null;
|
||||||
|
int? endCalibration = null;
|
||||||
|
int? startCalibration = null;
|
||||||
|
#if NET
|
||||||
|
string[] lines = File.ReadAllLines(path, System.Text.Encoding.Latin1); // µ³®
|
||||||
|
# else
|
||||||
|
string[] lines = File.ReadAllLines(path, System.Text.Encoding.GetEncoding("ISO-8859-1")); // µ³®
|
||||||
|
# endif
|
||||||
|
string? fileVersion = !lines.Any() ? null : GetFileVersion(lines.First());
|
||||||
|
for (int i = 1; i < lines.Length; i++)
|
||||||
|
{
|
||||||
|
if (lines[i].StartsWith("--INFO--"))
|
||||||
|
startInfo = i + 1;
|
||||||
|
else if (lines[i].StartsWith("--SETUP--"))
|
||||||
|
(endInfo, startSetup) = (i, i + 1);
|
||||||
|
else if (lines[i].StartsWith("--LAYERS--"))
|
||||||
|
(endSetup, startLayers) = (i, i + 1);
|
||||||
|
else if (lines[i].StartsWith("--PROFILES--"))
|
||||||
|
(endLayers, startProfiles) = (i, i + 1);
|
||||||
|
else if (lines[i].StartsWith("--CALIBRATION--"))
|
||||||
|
(endProfiles, startCalibration) = (i, i + 1);
|
||||||
|
else if (lines[i].StartsWith("--RAWDATA--"))
|
||||||
|
(endCalibration, startRawData) = (i, i + 1);
|
||||||
|
}
|
||||||
|
RawData? rawData = startRawData is null ? null : RawData.GetRawData(lines, startRawData.Value, lines.Length);
|
||||||
|
Info? info = startInfo is null || endInfo is null ? null : Info.GetInfo(lines, startInfo.Value, endInfo.Value);
|
||||||
|
Setup? setup = startSetup is null || endSetup is null ? null : Setup.GetSetup(lines, startSetup.Value, endSetup.Value);
|
||||||
|
LayerHeader? layerHeader = startLayers is null || endLayers is null ? null : LayerHeader.GetLayerHeader(lines, startLayers.Value, endLayers.Value);
|
||||||
|
ProfileHeader? profileHeader = startProfiles is null || endProfiles is null ? null : ProfileHeader.GetProfileHeader(lines, startProfiles.Value, endProfiles.Value);
|
||||||
|
Calibration? calibration = startCalibration is null || endCalibration is null ? null : Calibration.GetCalibration(lines, startCalibration.Value, endCalibration.Value);
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
FileVersion = fileVersion,
|
||||||
|
Info = info,
|
||||||
|
Setup = setup,
|
||||||
|
LayerHeader = layerHeader,
|
||||||
|
ProfileHeader = profileHeader,
|
||||||
|
Calibration = calibration,
|
||||||
|
RawData = rawData,
|
||||||
|
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetFileVersion(string line)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
string[] segments = line.Split(',');
|
||||||
|
if (segments.Length < 2)
|
||||||
|
result = string.Empty;
|
||||||
|
else
|
||||||
|
result = segments.Last();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
132
Server/Services/csv/Calibration.cs
Normal file
132
Server/Services/csv/Calibration.cs
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Calibration
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string NumberOfCalibrationSets { get; set; }
|
||||||
|
public List<DataSet> DataSets { get; set; }
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable CA1834
|
||||||
|
|
||||||
|
internal static Calibration? GetCalibration(string[] lines, int start, int stop)
|
||||||
|
{
|
||||||
|
Calibration? result;
|
||||||
|
string first;
|
||||||
|
DataSet dataSet;
|
||||||
|
Position position;
|
||||||
|
string[] segments;
|
||||||
|
int? thirdStart = null;
|
||||||
|
int? secondStart = null;
|
||||||
|
List<Position> positions;
|
||||||
|
List<string> values = new();
|
||||||
|
List<DataSet> dataSets = new();
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
for (int i = start; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "DataSet:")
|
||||||
|
{
|
||||||
|
secondStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Append(first).Append(",");
|
||||||
|
if (segments.Length > 1)
|
||||||
|
values.Add(segments[1]);
|
||||||
|
else
|
||||||
|
values.Add(string.Empty);
|
||||||
|
}
|
||||||
|
string header = "Number of Calibration Sets,";
|
||||||
|
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
NumberOfCalibrationSets = values[0],
|
||||||
|
DataSets = dataSets,
|
||||||
|
};
|
||||||
|
for (int x = 0; x < int.MaxValue; x++)
|
||||||
|
{
|
||||||
|
values.Clear();
|
||||||
|
_ = stringBuilder.Clear();
|
||||||
|
if (secondStart is null)
|
||||||
|
break;
|
||||||
|
for (int i = secondStart.Value; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "Resistivity(ohm-cm)")
|
||||||
|
{
|
||||||
|
thirdStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (first == " Sample Set:")
|
||||||
|
continue;
|
||||||
|
_ = stringBuilder.Append(first).Append(",");
|
||||||
|
if (segments.Length > 1)
|
||||||
|
values.Add(segments[1]);
|
||||||
|
else
|
||||||
|
values.Add(string.Empty);
|
||||||
|
}
|
||||||
|
secondStart = null;
|
||||||
|
header = "Operator,Date & Time,Finish,Orientation,North Probe ID,South Probe ID,Polarity,Contact Radius (µm),Probe Spacing (µm),Load (gm),X Step (µm),Name,Plate ID,Type,Points per Sample,Number of Pairs,";
|
||||||
|
if (thirdStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
positions = new();
|
||||||
|
dataSet = new()
|
||||||
|
{
|
||||||
|
Operator = values[0],
|
||||||
|
DateTime = values[1],
|
||||||
|
Finish = values[2],
|
||||||
|
Orientation = values[3],
|
||||||
|
NorthProbeID = values[4],
|
||||||
|
SouthProbeID = values[5],
|
||||||
|
Polarity = values[6],
|
||||||
|
ContactRadius = values[7],
|
||||||
|
ProbeSpacing = values[8],
|
||||||
|
Load = values[9],
|
||||||
|
XStep = values[10],
|
||||||
|
Name = values[11],
|
||||||
|
PlateId = values[12],
|
||||||
|
Type = values[13],
|
||||||
|
PointsPerSample = values[14],
|
||||||
|
NumberOfPairs = values[15],
|
||||||
|
Positions = positions,
|
||||||
|
};
|
||||||
|
dataSets.Add(dataSet);
|
||||||
|
for (int i = thirdStart.Value; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "DataSet:")
|
||||||
|
{
|
||||||
|
secondStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (segments.Length < 5)
|
||||||
|
continue;
|
||||||
|
position = new()
|
||||||
|
{
|
||||||
|
Resistivity = segments[0],
|
||||||
|
Resistance = segments[1],
|
||||||
|
PercentStandardDeviation = segments[2],
|
||||||
|
Number = segments[3],
|
||||||
|
Name = segments[4],
|
||||||
|
};
|
||||||
|
positions.Add(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
27
Server/Services/csv/DataSet.cs
Normal file
27
Server/Services/csv/DataSet.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class DataSet
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Operator { get; set; }
|
||||||
|
public string DateTime { get; set; }
|
||||||
|
public string Finish { get; set; }
|
||||||
|
public string Orientation { get; set; }
|
||||||
|
public string NorthProbeID { get; set; }
|
||||||
|
public string SouthProbeID { get; set; }
|
||||||
|
public string Polarity { get; set; }
|
||||||
|
public string ContactRadius { get; set; }
|
||||||
|
public string ProbeSpacing { get; set; }
|
||||||
|
public string Load { get; set; }
|
||||||
|
public string XStep { get; set; }
|
||||||
|
// public string SampleSet { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string PlateId { get; set; }
|
||||||
|
public string Type { get; set; }
|
||||||
|
public string PointsPerSample { get; set; }
|
||||||
|
public string NumberOfPairs { get; set; }
|
||||||
|
public List<Position> Positions { get; set; }
|
||||||
|
|
||||||
|
}
|
72
Server/Services/csv/Info.cs
Normal file
72
Server/Services/csv/Info.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Info
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Operator { get; set; }
|
||||||
|
public string SampleName { get; set; }
|
||||||
|
public string SoftwareVersion { get; set; }
|
||||||
|
public string DateTime { get; set; }
|
||||||
|
public string SystemId { get; set; }
|
||||||
|
public string SystemSite { get; set; }
|
||||||
|
public string SamplePosition { get; set; }
|
||||||
|
public string Units { get; set; }
|
||||||
|
public string CommentLength { get; set; }
|
||||||
|
public List<string> Comments { get; set; }
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable CA1834
|
||||||
|
|
||||||
|
internal static Info? GetInfo(string[] lines, int start, int stop)
|
||||||
|
{
|
||||||
|
Info? result;
|
||||||
|
string first;
|
||||||
|
string[] segments;
|
||||||
|
int? secondStart = null;
|
||||||
|
List<string> values = new();
|
||||||
|
List<string> comments = new();
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
for (int i = start; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "Comment:")
|
||||||
|
{
|
||||||
|
secondStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Append(first).Append(",");
|
||||||
|
if (segments.Length > 1)
|
||||||
|
values.Add(segments[1]);
|
||||||
|
else
|
||||||
|
values.Add(string.Empty);
|
||||||
|
}
|
||||||
|
string header = "Operator,Sample Name,Software Version,Date & Time,System ID,System Site,Sample Position,Units,Comment Length,";
|
||||||
|
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
Operator = values[0],
|
||||||
|
SampleName = values[1],
|
||||||
|
SoftwareVersion = values[2],
|
||||||
|
DateTime = values[3],
|
||||||
|
SystemId = values[4],
|
||||||
|
SystemSite = values[5],
|
||||||
|
SamplePosition = values[6],
|
||||||
|
Units = values[7],
|
||||||
|
CommentLength = values[8],
|
||||||
|
Comments = comments,
|
||||||
|
};
|
||||||
|
for (int i = secondStart.Value; i < stop; i++)
|
||||||
|
comments.Add(lines[i]);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
Server/Services/csv/Layer.cs
Normal file
24
Server/Services/csv/Layer.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Layer
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string FirstPoint { get; set; }
|
||||||
|
public string LastPoint { get; set; }
|
||||||
|
public string Type { get; set; }
|
||||||
|
public string Smoothing { get; set; }
|
||||||
|
public string Apply { get; set; }
|
||||||
|
public string SOrder { get; set; }
|
||||||
|
public string GOrder { get; set; }
|
||||||
|
public string Correction { get; set; }
|
||||||
|
public string Conversion { get; set; }
|
||||||
|
public string JunctionOption { get; set; }
|
||||||
|
public string JunctionConstant { get; set; }
|
||||||
|
public string CurrentDensity { get; set; }
|
||||||
|
public string M1M2Tolerance { get; set; }
|
||||||
|
public string Sheet { get; set; }
|
||||||
|
public string Dose { get; set; }
|
||||||
|
|
||||||
|
}
|
80
Server/Services/csv/LayerHeader.cs
Normal file
80
Server/Services/csv/LayerHeader.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class LayerHeader
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string NumberOfLayers { get; set; }
|
||||||
|
public List<Layer> Layers { get; set; }
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable CA1834
|
||||||
|
|
||||||
|
internal static LayerHeader? GetLayerHeader(string[] lines, int start, int stop)
|
||||||
|
{
|
||||||
|
LayerHeader? result;
|
||||||
|
Layer layer;
|
||||||
|
string first;
|
||||||
|
string[] segments;
|
||||||
|
int? secondStart = null;
|
||||||
|
List<Layer> layerCollection = new();
|
||||||
|
List<string> values = new();
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
for (int i = start; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "Layer")
|
||||||
|
{
|
||||||
|
secondStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Append(first).Append(",");
|
||||||
|
if (segments.Length > 1)
|
||||||
|
values.Add(segments[1]);
|
||||||
|
else
|
||||||
|
values.Add(string.Empty);
|
||||||
|
}
|
||||||
|
string header = "Number of Layers,";
|
||||||
|
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
NumberOfLayers = values[0],
|
||||||
|
Layers = layerCollection,
|
||||||
|
};
|
||||||
|
for (int i = secondStart.Value; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
if (segments.Length < 15)
|
||||||
|
continue;
|
||||||
|
layer = new()
|
||||||
|
{
|
||||||
|
FirstPoint = segments[0],
|
||||||
|
LastPoint = segments[1],
|
||||||
|
Type = segments[2],
|
||||||
|
Smoothing = segments[3],
|
||||||
|
Apply = segments[4],
|
||||||
|
SOrder = segments[5],
|
||||||
|
GOrder = segments[6],
|
||||||
|
Correction = segments[7],
|
||||||
|
Conversion = segments[8],
|
||||||
|
JunctionOption = segments[9],
|
||||||
|
JunctionConstant = segments[10],
|
||||||
|
CurrentDensity = segments[11],
|
||||||
|
M1M2Tolerance = segments[12],
|
||||||
|
Sheet = segments[13],
|
||||||
|
Dose = segments[14],
|
||||||
|
};
|
||||||
|
layerCollection.Add(layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
Server/Services/csv/Point.cs
Normal file
16
Server/Services/csv/Point.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Point
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Number { get; set; }
|
||||||
|
public string Depth { get; set; }
|
||||||
|
public string Resistance { get; set; }
|
||||||
|
public string StageX { get; set; }
|
||||||
|
public string StageY { get; set; }
|
||||||
|
public string StageZ { get; set; }
|
||||||
|
public string StageT { get; set; }
|
||||||
|
|
||||||
|
}
|
14
Server/Services/csv/Position.cs
Normal file
14
Server/Services/csv/Position.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Position
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Resistivity { get; set; }
|
||||||
|
public string Resistance { get; set; }
|
||||||
|
public string PercentStandardDeviation { get; set; }
|
||||||
|
public string Number { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
}
|
15
Server/Services/csv/Profile.cs
Normal file
15
Server/Services/csv/Profile.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Profile
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Label { get; set; }
|
||||||
|
public string Allocated { get; set; }
|
||||||
|
public string Used { get; set; }
|
||||||
|
public string List { get; set; }
|
||||||
|
|
||||||
|
}
|
101
Server/Services/csv/ProfileHeader.cs
Normal file
101
Server/Services/csv/ProfileHeader.cs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class ProfileHeader
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string NumberOfProfiles { get; set; }
|
||||||
|
public List<Profile> Profiles { get; set; }
|
||||||
|
public List<ProfilePoint> ProfilePoints { get; set; }
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable CA1834
|
||||||
|
|
||||||
|
internal static ProfileHeader? GetProfileHeader(string[] lines, int start, int stop)
|
||||||
|
{
|
||||||
|
ProfileHeader? result;
|
||||||
|
string first;
|
||||||
|
string[] segments;
|
||||||
|
Profile profileInfo;
|
||||||
|
ProfilePoint profile;
|
||||||
|
int? thirdStart = null;
|
||||||
|
int? secondStart = null;
|
||||||
|
List<string> values = new();
|
||||||
|
List<Profile> profiles = new();
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
List<ProfilePoint> profilePoints = new();
|
||||||
|
for (int i = start; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "ID")
|
||||||
|
{
|
||||||
|
secondStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Append(first).Append(",");
|
||||||
|
if (segments.Length > 1)
|
||||||
|
values.Add(segments[1]);
|
||||||
|
else
|
||||||
|
values.Add(string.Empty);
|
||||||
|
}
|
||||||
|
string header = "Number of Profiles,";
|
||||||
|
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
NumberOfProfiles = values[0],
|
||||||
|
Profiles = profiles,
|
||||||
|
ProfilePoints = profilePoints,
|
||||||
|
};
|
||||||
|
for (int i = secondStart.Value; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "Point")
|
||||||
|
{
|
||||||
|
thirdStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (segments.Length < 6)
|
||||||
|
continue;
|
||||||
|
profileInfo = new()
|
||||||
|
{
|
||||||
|
Id = segments[0],
|
||||||
|
Name = segments[1],
|
||||||
|
Label = segments[2],
|
||||||
|
Allocated = segments[3],
|
||||||
|
Used = segments[4],
|
||||||
|
List = segments[5],
|
||||||
|
};
|
||||||
|
profiles.Add(profileInfo);
|
||||||
|
}
|
||||||
|
if (thirdStart is not null)
|
||||||
|
{
|
||||||
|
for (int i = thirdStart.Value; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
if (segments.Length < 6)
|
||||||
|
continue;
|
||||||
|
profile = new()
|
||||||
|
{
|
||||||
|
Number = segments[0],
|
||||||
|
Depth = segments[1],
|
||||||
|
Raw = segments[2],
|
||||||
|
Edited = segments[3],
|
||||||
|
Resistivity = segments[4],
|
||||||
|
CD = segments[5],
|
||||||
|
};
|
||||||
|
profilePoints.Add(profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
15
Server/Services/csv/ProfilePoint.cs
Normal file
15
Server/Services/csv/ProfilePoint.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class ProfilePoint
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Number { get; set; }
|
||||||
|
public string Depth { get; set; }
|
||||||
|
public string Raw { get; set; }
|
||||||
|
public string Edited { get; set; }
|
||||||
|
public string Resistivity { get; set; }
|
||||||
|
public string CD { get; set; }
|
||||||
|
|
||||||
|
}
|
72
Server/Services/csv/RawData.cs
Normal file
72
Server/Services/csv/RawData.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class RawData
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string TotalPoints { get; set; }
|
||||||
|
public List<Point> Points { get; set; }
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable CA1834
|
||||||
|
|
||||||
|
internal static RawData? GetRawData(string[] lines, int start, int stop)
|
||||||
|
{
|
||||||
|
RawData? result;
|
||||||
|
Point point;
|
||||||
|
string first;
|
||||||
|
string[] segments;
|
||||||
|
int? secondStart = null;
|
||||||
|
List<Point> points = new();
|
||||||
|
List<string> values = new();
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
for (int i = start; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "Point")
|
||||||
|
{
|
||||||
|
secondStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Append(first).Append(",");
|
||||||
|
if (segments.Length > 1)
|
||||||
|
values.Add(segments[1]);
|
||||||
|
else
|
||||||
|
values.Add(string.Empty);
|
||||||
|
}
|
||||||
|
string header = "Total Points,";
|
||||||
|
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
TotalPoints = values[0],
|
||||||
|
Points = points,
|
||||||
|
};
|
||||||
|
for (int i = secondStart.Value; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
if (segments.Length < 4)
|
||||||
|
continue;
|
||||||
|
point = new()
|
||||||
|
{
|
||||||
|
Number = segments[0],
|
||||||
|
Depth = segments[1],
|
||||||
|
Resistance = segments[2],
|
||||||
|
StageX = segments[3],
|
||||||
|
StageY = segments[4],
|
||||||
|
StageZ = segments[5],
|
||||||
|
StageT = segments[6],
|
||||||
|
};
|
||||||
|
points.Add(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
87
Server/Services/csv/Setup.cs
Normal file
87
Server/Services/csv/Setup.cs
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Setup
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Finish { get; set; }
|
||||||
|
public string NorthProbeID { get; set; }
|
||||||
|
public string SouthProbeID { get; set; }
|
||||||
|
public string MeasurementPolarity { get; set; }
|
||||||
|
public string SineBevelAngle { get; set; }
|
||||||
|
public string ContactRadius { get; set; }
|
||||||
|
public string ProbeSpacing { get; set; }
|
||||||
|
public string ProbeLoad { get; set; }
|
||||||
|
public string Orientation { get; set; }
|
||||||
|
public string NumberOfStepSizes { get; set; }
|
||||||
|
public List<Step> Steps { get; set; }
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable CA1834
|
||||||
|
|
||||||
|
internal static Setup? GetSetup(string[] lines, int start, int stop)
|
||||||
|
{
|
||||||
|
Setup? result;
|
||||||
|
Step step;
|
||||||
|
string first;
|
||||||
|
string[] segments;
|
||||||
|
int? secondStart = null;
|
||||||
|
List<Step> steps = new();
|
||||||
|
List<string> values = new();
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
for (int i = start; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
first = segments.First();
|
||||||
|
if (first == "Step")
|
||||||
|
{
|
||||||
|
secondStart = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Append(first).Append(",");
|
||||||
|
if (segments.Length > 1)
|
||||||
|
values.Add(segments[1]);
|
||||||
|
else
|
||||||
|
values.Add(string.Empty);
|
||||||
|
}
|
||||||
|
string header = "Finish,North Probe ID,South Probe ID,Measurement Polarity,Sine Bevel Angle,Contact Radius (µm),Probe Spacing (µm),Probe Load (gm),Orientation,Number of Step Sizes,";
|
||||||
|
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
Finish = values[0],
|
||||||
|
NorthProbeID = values[1],
|
||||||
|
SouthProbeID = values[2],
|
||||||
|
MeasurementPolarity = values[3],
|
||||||
|
SineBevelAngle = values[4],
|
||||||
|
ContactRadius = values[5],
|
||||||
|
ProbeSpacing = values[6],
|
||||||
|
ProbeLoad = values[7],
|
||||||
|
Orientation = values[8],
|
||||||
|
NumberOfStepSizes = values[9],
|
||||||
|
Steps = steps,
|
||||||
|
};
|
||||||
|
for (int i = secondStart.Value; i < stop; i++)
|
||||||
|
{
|
||||||
|
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||||
|
if (segments.Length < 4)
|
||||||
|
continue;
|
||||||
|
step = new()
|
||||||
|
{
|
||||||
|
Number = segments[0],
|
||||||
|
Points = segments[1],
|
||||||
|
X = segments[2],
|
||||||
|
Y = segments[3],
|
||||||
|
};
|
||||||
|
steps.Add(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
13
Server/Services/csv/Step.cs
Normal file
13
Server/Services/csv/Step.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace Adaptation.FileHandlers.csv;
|
||||||
|
|
||||||
|
public class Step
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
public string Number { get; set; }
|
||||||
|
public string Points { get; set; }
|
||||||
|
public string X { get; set; }
|
||||||
|
public string Y { get; set; }
|
||||||
|
|
||||||
|
}
|
27
Server/Services/json/CSV.cs
Normal file
27
Server/Services/json/CSV.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class CSV
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
public string? FileVersion { get; }
|
||||||
|
public Info? Info { get; }
|
||||||
|
public Setup? Setup { get; }
|
||||||
|
public LayerHeader? LayerHeader { get; }
|
||||||
|
public ProfileHeader? ProfileHeader { get; }
|
||||||
|
public Calibration? Calibration { get; }
|
||||||
|
public RawData? RawData { get; }
|
||||||
|
|
||||||
|
internal CSV(csv.CSV csv)
|
||||||
|
{
|
||||||
|
FileVersion = csv.FileVersion;
|
||||||
|
Info = csv.Info is null ? null : new(csv.Info);
|
||||||
|
Setup = csv.Setup is null ? null : new(csv.Setup);
|
||||||
|
RawData = csv.RawData is null ? null : new(csv.RawData);
|
||||||
|
Calibration = csv.Calibration is null ? null : new(csv.Calibration);
|
||||||
|
LayerHeader = csv.LayerHeader is null ? null : new(csv.LayerHeader);
|
||||||
|
ProfileHeader = csv.ProfileHeader is null ? null : new(csv.ProfileHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
56
Server/Services/json/Calibration.cs
Normal file
56
Server/Services/json/Calibration.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Calibration
|
||||||
|
{
|
||||||
|
|
||||||
|
public int NumberOfCalibrationSets { get; }
|
||||||
|
public List<DataSet> DataSets { get; }
|
||||||
|
|
||||||
|
internal Calibration(csv.Calibration calibration)
|
||||||
|
{
|
||||||
|
DataSet dataSet;
|
||||||
|
Position position;
|
||||||
|
List<Position> positions;
|
||||||
|
List<DataSet> dataSets = new();
|
||||||
|
NumberOfCalibrationSets = int.Parse(calibration.NumberOfCalibrationSets);
|
||||||
|
DataSets = dataSets;
|
||||||
|
foreach (csv.DataSet csvDataSet in calibration.DataSets)
|
||||||
|
{
|
||||||
|
positions = new();
|
||||||
|
foreach (csv.Position csvPosition in csvDataSet.Positions)
|
||||||
|
{
|
||||||
|
position = new
|
||||||
|
(
|
||||||
|
resistivity: double.Parse(csvPosition.Resistivity),
|
||||||
|
resistance: double.Parse(csvPosition.Resistance),
|
||||||
|
percentStandardDeviation: double.Parse(csvPosition.PercentStandardDeviation),
|
||||||
|
number: int.Parse(csvPosition.Number),
|
||||||
|
name: csvPosition.Name
|
||||||
|
);
|
||||||
|
positions.Add(position);
|
||||||
|
}
|
||||||
|
dataSet = new
|
||||||
|
(
|
||||||
|
@operator: csvDataSet.Operator,
|
||||||
|
dateTime: DateTime.Parse(csvDataSet.DateTime),
|
||||||
|
finish: csvDataSet.Finish,
|
||||||
|
orientation: csvDataSet.Orientation,
|
||||||
|
northProbeID: csvDataSet.NorthProbeID,
|
||||||
|
southProbeID: csvDataSet.SouthProbeID,
|
||||||
|
polarity: csvDataSet.Polarity,
|
||||||
|
contactRadius: double.Parse(csvDataSet.ContactRadius),
|
||||||
|
probeSpacing: double.Parse(csvDataSet.ProbeSpacing),
|
||||||
|
load: double.Parse(csvDataSet.Load),
|
||||||
|
xStep: double.Parse(csvDataSet.XStep),
|
||||||
|
name: csvDataSet.Name,
|
||||||
|
plateId: csvDataSet.PlateId,
|
||||||
|
type: csvDataSet.Type,
|
||||||
|
pointsPerSample: int.Parse(csvDataSet.PointsPerSample),
|
||||||
|
numberOfPairs: int.Parse(csvDataSet.NumberOfPairs),
|
||||||
|
positions: positions
|
||||||
|
);
|
||||||
|
dataSets.Add(dataSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
62
Server/Services/json/DataSet.cs
Normal file
62
Server/Services/json/DataSet.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class DataSet
|
||||||
|
{
|
||||||
|
|
||||||
|
public string Operator { get; }
|
||||||
|
public DateTime DateTime { get; }
|
||||||
|
public string Finish { get; }
|
||||||
|
public string Orientation { get; }
|
||||||
|
public string NorthProbeID { get; }
|
||||||
|
public string SouthProbeID { get; }
|
||||||
|
public string Polarity { get; }
|
||||||
|
public double ContactRadius { get; }
|
||||||
|
public double ProbeSpacing { get; }
|
||||||
|
public double Load { get; }
|
||||||
|
public double XStep { get; }
|
||||||
|
// public string SampleSet { get; }
|
||||||
|
public string Name { get; }
|
||||||
|
public string PlateId { get; }
|
||||||
|
public string Type { get; }
|
||||||
|
public int PointsPerSample { get; }
|
||||||
|
public int NumberOfPairs { get; }
|
||||||
|
public List<Position> Positions { get; }
|
||||||
|
|
||||||
|
public DataSet(string @operator,
|
||||||
|
DateTime dateTime,
|
||||||
|
string finish,
|
||||||
|
string orientation,
|
||||||
|
string northProbeID,
|
||||||
|
string southProbeID,
|
||||||
|
string polarity,
|
||||||
|
double contactRadius,
|
||||||
|
double probeSpacing,
|
||||||
|
double load,
|
||||||
|
double xStep,
|
||||||
|
string name,
|
||||||
|
string plateId,
|
||||||
|
string type,
|
||||||
|
int pointsPerSample,
|
||||||
|
int numberOfPairs,
|
||||||
|
List<Position> positions)
|
||||||
|
{
|
||||||
|
Operator = @operator;
|
||||||
|
DateTime = dateTime;
|
||||||
|
Finish = finish;
|
||||||
|
Orientation = orientation;
|
||||||
|
NorthProbeID = northProbeID;
|
||||||
|
SouthProbeID = southProbeID;
|
||||||
|
Polarity = polarity;
|
||||||
|
ContactRadius = contactRadius;
|
||||||
|
ProbeSpacing = probeSpacing;
|
||||||
|
Load = load;
|
||||||
|
XStep = xStep;
|
||||||
|
Name = name;
|
||||||
|
PlateId = plateId;
|
||||||
|
Type = type;
|
||||||
|
PointsPerSample = pointsPerSample;
|
||||||
|
NumberOfPairs = numberOfPairs;
|
||||||
|
Positions = positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
31
Server/Services/json/Info.cs
Normal file
31
Server/Services/json/Info.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Info
|
||||||
|
{
|
||||||
|
|
||||||
|
public string Operator { get; }
|
||||||
|
public string SampleName { get; }
|
||||||
|
public string SoftwareVersion { get; }
|
||||||
|
public DateTime DateTime { get; }
|
||||||
|
public string SystemId { get; }
|
||||||
|
public string SystemSite { get; }
|
||||||
|
public int SamplePosition { get; }
|
||||||
|
public int Units { get; }
|
||||||
|
public int CommentLength { get; }
|
||||||
|
public List<string> Comments { get; }
|
||||||
|
|
||||||
|
internal Info(csv.Info info)
|
||||||
|
{
|
||||||
|
Operator = info.Operator;
|
||||||
|
SampleName = info.SampleName;
|
||||||
|
SoftwareVersion = info.SoftwareVersion;
|
||||||
|
DateTime = DateTime.Parse(info.DateTime);
|
||||||
|
SystemId = info.SystemId;
|
||||||
|
SystemSite = info.SystemSite;
|
||||||
|
SamplePosition = int.Parse(info.SamplePosition);
|
||||||
|
Units = int.Parse(info.Units);
|
||||||
|
CommentLength = int.Parse(info.CommentLength);
|
||||||
|
Comments = info.Comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
55
Server/Services/json/Layer.cs
Normal file
55
Server/Services/json/Layer.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Layer
|
||||||
|
{
|
||||||
|
|
||||||
|
public int FirstPoint { get; }
|
||||||
|
public int? LastPoint { get; }
|
||||||
|
public string Type { get; }
|
||||||
|
public string Smoothing { get; }
|
||||||
|
public string Apply { get; }
|
||||||
|
public int SOrder { get; }
|
||||||
|
public int GOrder { get; }
|
||||||
|
public string Correction { get; }
|
||||||
|
public string Conversion { get; }
|
||||||
|
public string JunctionOption { get; }
|
||||||
|
public int JunctionConstant { get; }
|
||||||
|
public double CurrentDensity { get; }
|
||||||
|
public string M1M2Tolerance { get; }
|
||||||
|
public string Sheet { get; }
|
||||||
|
public string Dose { get; }
|
||||||
|
|
||||||
|
public Layer(int firstPoint,
|
||||||
|
int? lastPoint,
|
||||||
|
string type,
|
||||||
|
string smoothing,
|
||||||
|
string apply,
|
||||||
|
int sOrder,
|
||||||
|
int gOrder,
|
||||||
|
string correction,
|
||||||
|
string conversion,
|
||||||
|
string junctionOption,
|
||||||
|
int junctionConstant,
|
||||||
|
double currentDensity,
|
||||||
|
string m1M2Tolerance,
|
||||||
|
string sheet,
|
||||||
|
string dose)
|
||||||
|
{
|
||||||
|
FirstPoint = firstPoint;
|
||||||
|
LastPoint = lastPoint;
|
||||||
|
Type = type;
|
||||||
|
Smoothing = smoothing;
|
||||||
|
Apply = apply;
|
||||||
|
SOrder = sOrder;
|
||||||
|
GOrder = gOrder;
|
||||||
|
Correction = correction;
|
||||||
|
Conversion = conversion;
|
||||||
|
JunctionOption = junctionOption;
|
||||||
|
JunctionConstant = junctionConstant;
|
||||||
|
CurrentDensity = currentDensity;
|
||||||
|
M1M2Tolerance = m1M2Tolerance;
|
||||||
|
Sheet = sheet;
|
||||||
|
Dose = dose;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
39
Server/Services/json/LayerHeader.cs
Normal file
39
Server/Services/json/LayerHeader.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class LayerHeader
|
||||||
|
{
|
||||||
|
|
||||||
|
public int NumberOfLayers { get; }
|
||||||
|
public List<Layer> Layers { get; }
|
||||||
|
|
||||||
|
internal LayerHeader(csv.LayerHeader layerHeader)
|
||||||
|
{
|
||||||
|
Layer layer;
|
||||||
|
List<Layer> layers = new();
|
||||||
|
NumberOfLayers = int.Parse(layerHeader.NumberOfLayers);
|
||||||
|
Layers = layers;
|
||||||
|
foreach (csv.Layer csvLayer in layerHeader.Layers)
|
||||||
|
{
|
||||||
|
layer = new
|
||||||
|
(
|
||||||
|
firstPoint: int.Parse(csvLayer.FirstPoint),
|
||||||
|
lastPoint: string.IsNullOrEmpty(csvLayer.LastPoint) ? null : int.Parse(csvLayer.LastPoint),
|
||||||
|
type: csvLayer.Type,
|
||||||
|
smoothing: csvLayer.Smoothing,
|
||||||
|
apply: csvLayer.Apply,
|
||||||
|
sOrder: int.Parse(csvLayer.SOrder),
|
||||||
|
gOrder: int.Parse(csvLayer.GOrder),
|
||||||
|
correction: csvLayer.Correction,
|
||||||
|
conversion: csvLayer.Conversion,
|
||||||
|
junctionOption: csvLayer.JunctionOption,
|
||||||
|
junctionConstant: int.Parse(csvLayer.JunctionConstant),
|
||||||
|
currentDensity: double.Parse(csvLayer.CurrentDensity),
|
||||||
|
m1M2Tolerance: csvLayer.M1M2Tolerance,
|
||||||
|
sheet: csvLayer.Sheet,
|
||||||
|
dose: csvLayer.Dose
|
||||||
|
);
|
||||||
|
layers.Add(layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
27
Server/Services/json/Log10.cs
Normal file
27
Server/Services/json/Log10.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Log10
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
public double Depth { get; }
|
||||||
|
public double ResistanceRaw { get; }
|
||||||
|
public double? ResistanceEdited { get; }
|
||||||
|
public double? Resistivity { get; }
|
||||||
|
public double? Concentration { get; }
|
||||||
|
|
||||||
|
public Log10(double depth,
|
||||||
|
double raw,
|
||||||
|
double? edited,
|
||||||
|
double? resistivity,
|
||||||
|
double? cd)
|
||||||
|
{
|
||||||
|
Depth = Math.Log10(depth);
|
||||||
|
ResistanceRaw = Math.Log10(raw);
|
||||||
|
ResistanceEdited = edited is null ? null : Math.Log10(edited.Value);
|
||||||
|
Resistivity = resistivity is null ? null : Math.Log10(resistivity.Value);
|
||||||
|
Concentration = cd is null ? null : Math.Log10(cd.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
31
Server/Services/json/Point.cs
Normal file
31
Server/Services/json/Point.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Point
|
||||||
|
{
|
||||||
|
|
||||||
|
public double Number { get; }
|
||||||
|
public double Depth { get; }
|
||||||
|
public double Resistance { get; }
|
||||||
|
public double StageX { get; }
|
||||||
|
public double StageY { get; }
|
||||||
|
public double StageZ { get; }
|
||||||
|
public double StageT { get; }
|
||||||
|
|
||||||
|
public Point(double number,
|
||||||
|
double depth,
|
||||||
|
double resistance,
|
||||||
|
double stageX,
|
||||||
|
double stageY,
|
||||||
|
double stageZ,
|
||||||
|
double stageT)
|
||||||
|
{
|
||||||
|
Number = number;
|
||||||
|
Depth = depth;
|
||||||
|
Resistance = resistance;
|
||||||
|
StageX = stageX;
|
||||||
|
StageY = stageY;
|
||||||
|
StageZ = stageZ;
|
||||||
|
StageT = stageT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
25
Server/Services/json/Position.cs
Normal file
25
Server/Services/json/Position.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Position
|
||||||
|
{
|
||||||
|
|
||||||
|
public double Resistivity { get; }
|
||||||
|
public double Resistance { get; }
|
||||||
|
public double PercentStandardDeviation { get; }
|
||||||
|
public int Number { get; }
|
||||||
|
public string Name { get; }
|
||||||
|
|
||||||
|
public Position(double resistivity,
|
||||||
|
double resistance,
|
||||||
|
double percentStandardDeviation,
|
||||||
|
int number,
|
||||||
|
string name)
|
||||||
|
{
|
||||||
|
Resistivity = resistivity;
|
||||||
|
Resistance = resistance;
|
||||||
|
PercentStandardDeviation = percentStandardDeviation;
|
||||||
|
Number = number;
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
Server/Services/json/Profile.cs
Normal file
28
Server/Services/json/Profile.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Profile
|
||||||
|
{
|
||||||
|
|
||||||
|
public string Id { get; }
|
||||||
|
public string Name { get; }
|
||||||
|
public string Label { get; }
|
||||||
|
public int Allocated { get; }
|
||||||
|
public int Used { get; }
|
||||||
|
public string List { get; }
|
||||||
|
|
||||||
|
public Profile(string id,
|
||||||
|
string name,
|
||||||
|
string label,
|
||||||
|
int allocated,
|
||||||
|
int used,
|
||||||
|
string list)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
Name = name;
|
||||||
|
Label = label;
|
||||||
|
Allocated = allocated;
|
||||||
|
Used = used;
|
||||||
|
List = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
52
Server/Services/json/ProfileHeader.cs
Normal file
52
Server/Services/json/ProfileHeader.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class ProfileHeader
|
||||||
|
{
|
||||||
|
|
||||||
|
public int NumberOfProfiles { get; }
|
||||||
|
public List<Profile> Profiles { get; }
|
||||||
|
public List<ProfilePoint> ProfilePoints { get; }
|
||||||
|
|
||||||
|
internal ProfileHeader(csv.ProfileHeader profileHeader)
|
||||||
|
{
|
||||||
|
Profile profile;
|
||||||
|
ProfilePoint profilePoint;
|
||||||
|
List<Profile> profiles = new();
|
||||||
|
csv.ProfilePoint csvProfilePoint;
|
||||||
|
ProfilePoint? lastProfilePoint = null;
|
||||||
|
List<ProfilePoint> profilePoints = new();
|
||||||
|
NumberOfProfiles = int.Parse(profileHeader.NumberOfProfiles);
|
||||||
|
Profiles = profiles;
|
||||||
|
ProfilePoints = profilePoints;
|
||||||
|
foreach (csv.Profile csvProfile in profileHeader.Profiles)
|
||||||
|
{
|
||||||
|
profile = new
|
||||||
|
(
|
||||||
|
id: csvProfile.Id,
|
||||||
|
name: csvProfile.Name,
|
||||||
|
label: csvProfile.Label,
|
||||||
|
allocated: int.Parse(csvProfile.Allocated),
|
||||||
|
used: int.Parse(csvProfile.Used),
|
||||||
|
list: csvProfile.List
|
||||||
|
);
|
||||||
|
profiles.Add(profile);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < profileHeader.ProfilePoints.Count; i++)
|
||||||
|
{
|
||||||
|
csvProfilePoint = profileHeader.ProfilePoints[i];
|
||||||
|
profilePoint = new
|
||||||
|
(
|
||||||
|
number: int.Parse(csvProfilePoint.Number),
|
||||||
|
depth: double.Parse(csvProfilePoint.Depth),
|
||||||
|
raw: double.Parse(csvProfilePoint.Raw),
|
||||||
|
edited: double.Parse(csvProfilePoint.Edited),
|
||||||
|
resistivity: double.Parse(csvProfilePoint.Resistivity),
|
||||||
|
cd: double.Parse(csvProfilePoint.CD),
|
||||||
|
lastProfilePoint: lastProfilePoint
|
||||||
|
);
|
||||||
|
profilePoints.Add(profilePoint);
|
||||||
|
lastProfilePoint = profilePoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
44
Server/Services/json/ProfilePoint.cs
Normal file
44
Server/Services/json/ProfilePoint.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class ProfilePoint
|
||||||
|
{
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
public int Number { get; }
|
||||||
|
public double Depth { get; }
|
||||||
|
public double ResistanceRaw { get; }
|
||||||
|
public double? ResistanceEdited { get; }
|
||||||
|
public double? Resistivity { get; }
|
||||||
|
public double? Concentration { get; }
|
||||||
|
public double? DeltaPercent { get; }
|
||||||
|
public ProfilePoint? LastProfilePoint { get; }
|
||||||
|
public Log10? Log10 { get; }
|
||||||
|
|
||||||
|
public ProfilePoint(int number,
|
||||||
|
double depth,
|
||||||
|
double raw,
|
||||||
|
double? edited,
|
||||||
|
double? resistivity,
|
||||||
|
double? cd,
|
||||||
|
ProfilePoint? lastProfilePoint)
|
||||||
|
{
|
||||||
|
Number = number;
|
||||||
|
Depth = depth;
|
||||||
|
ResistanceRaw = raw;
|
||||||
|
ResistanceEdited = edited;
|
||||||
|
Resistivity = resistivity;
|
||||||
|
Concentration = cd;
|
||||||
|
DeltaPercent = lastProfilePoint is null ? null : (lastProfilePoint.ResistanceRaw - raw) / raw;
|
||||||
|
LastProfilePoint = lastProfilePoint;
|
||||||
|
Log10 = new
|
||||||
|
(
|
||||||
|
depth: depth,
|
||||||
|
raw: raw,
|
||||||
|
edited: edited,
|
||||||
|
resistivity: resistivity,
|
||||||
|
cd: cd
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
31
Server/Services/json/RawData.cs
Normal file
31
Server/Services/json/RawData.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class RawData
|
||||||
|
{
|
||||||
|
|
||||||
|
public int TotalPoints { get; }
|
||||||
|
public List<Point> Points { get; }
|
||||||
|
|
||||||
|
internal RawData(csv.RawData rawData)
|
||||||
|
{
|
||||||
|
Point point;
|
||||||
|
List<Point> points = new();
|
||||||
|
TotalPoints = int.Parse(rawData.TotalPoints);
|
||||||
|
Points = points;
|
||||||
|
foreach (csv.Point csvPoint in rawData.Points)
|
||||||
|
{
|
||||||
|
point = new
|
||||||
|
(
|
||||||
|
number: double.Parse(csvPoint.Number),
|
||||||
|
depth: double.Parse(csvPoint.Depth),
|
||||||
|
resistance: double.Parse(csvPoint.Resistance),
|
||||||
|
stageX: double.Parse(csvPoint.StageX),
|
||||||
|
stageY: double.Parse(csvPoint.StageY),
|
||||||
|
stageZ: double.Parse(csvPoint.StageZ),
|
||||||
|
stageT: double.Parse(csvPoint.StageT)
|
||||||
|
);
|
||||||
|
points.Add(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
47
Server/Services/json/Setup.cs
Normal file
47
Server/Services/json/Setup.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Setup
|
||||||
|
{
|
||||||
|
|
||||||
|
public string Finish { get; }
|
||||||
|
public string NorthProbeID { get; }
|
||||||
|
public string SouthProbeID { get; }
|
||||||
|
public string MeasurementPolarity { get; }
|
||||||
|
public double SineBevelAngle { get; }
|
||||||
|
public double ContactRadius { get; }
|
||||||
|
public double ProbeSpacing { get; }
|
||||||
|
public double ProbeLoad { get; }
|
||||||
|
public string Orientation { get; }
|
||||||
|
public int NumberOfStepSizes { get; }
|
||||||
|
public List<Step> Steps { get; }
|
||||||
|
|
||||||
|
internal Setup(csv.Setup setup)
|
||||||
|
{
|
||||||
|
Step step;
|
||||||
|
List<Step> steps = new();
|
||||||
|
Finish = setup.Finish;
|
||||||
|
NorthProbeID = setup.NorthProbeID;
|
||||||
|
SouthProbeID = setup.SouthProbeID;
|
||||||
|
MeasurementPolarity = setup.MeasurementPolarity;
|
||||||
|
SineBevelAngle = double.Parse(setup.SineBevelAngle);
|
||||||
|
ContactRadius = double.Parse(setup.ContactRadius);
|
||||||
|
ProbeSpacing = double.Parse(setup.ProbeSpacing);
|
||||||
|
ProbeLoad = double.Parse(setup.ProbeLoad);
|
||||||
|
Orientation = setup.Orientation;
|
||||||
|
NumberOfStepSizes = int.Parse(setup.NumberOfStepSizes);
|
||||||
|
Steps = steps;
|
||||||
|
foreach (csv.Step csvStep in setup.Steps)
|
||||||
|
{
|
||||||
|
Step step1 = new
|
||||||
|
(
|
||||||
|
number: int.Parse(csvStep.Number),
|
||||||
|
points: int.Parse(csvStep.Points),
|
||||||
|
x: double.Parse(csvStep.X),
|
||||||
|
y: double.Parse(csvStep.Y)
|
||||||
|
);
|
||||||
|
step = step1;
|
||||||
|
steps.Add(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
Server/Services/json/Step.cs
Normal file
22
Server/Services/json/Step.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
namespace Adaptation.FileHandlers.json;
|
||||||
|
|
||||||
|
public class Step
|
||||||
|
{
|
||||||
|
|
||||||
|
public int Number { get; }
|
||||||
|
public int Points { get; }
|
||||||
|
public double X { get; }
|
||||||
|
public double Y { get; }
|
||||||
|
|
||||||
|
public Step(int number,
|
||||||
|
int points,
|
||||||
|
double x,
|
||||||
|
double y)
|
||||||
|
{
|
||||||
|
Number = number;
|
||||||
|
Points = points;
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -35,6 +35,12 @@
|
|||||||
</label>
|
</label>
|
||||||
<input class="form-check-input" type="checkbox" id="chkAutoRefresh">
|
<input class="form-check-input" type="checkbox" id="chkAutoRefresh">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-check-label" for="chkCopyOnGet">
|
||||||
|
Copy-On-Get
|
||||||
|
</label>
|
||||||
|
<input class="form-check-input" type="checkbox" id="chkCopyOnGet">
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div style="height: 300px;" id="HeaderGridDiv">
|
<div style="height: 300px;" id="HeaderGridDiv">
|
||||||
@ -73,9 +79,16 @@
|
|||||||
<span id="OIExportResult" style="margin-left: 10px; font-weight: bold; color: #366b02;"></span>
|
<span id="OIExportResult" style="margin-left: 10px; font-weight: bold; color: #366b02;"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p style="text-align: center; margin-top: 20px;">
|
<p style="margin-top: 20px;">
|
||||||
<iframe id="DataAttachmentFrame" style="height:900px; border-width:thin; margin-right: 10px;" hidden></iframe>
|
<iframe id="DataAttachmentFrame" style="height:900px; border-width:thin; margin-right: 10px;" hidden></iframe>
|
||||||
<iframe id="HeaderAttachmentFrame" style="height:900px; border-width:thin;" hidden></iframe>
|
<iframe id="HeaderAttachmentFrame" style="height:900px; border-width:thin;" hidden></iframe>
|
||||||
|
|
||||||
|
<div id="DataAttachmentDiv" hidden>
|
||||||
|
<canvas id="DataAttachmentCanvas"></canvas>
|
||||||
|
</div>
|
||||||
|
<div id="HeaderAttachmentDiv" hidden>
|
||||||
|
<canvas id="HeaderAttachmentCanvas"></canvas>
|
||||||
|
</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
<script src="~/igniteui/js/infragistics.lob.js" type="text/javascript" asp-append-version="true"></script>
|
<script src="~/igniteui/js/infragistics.lob.js" type="text/javascript" asp-append-version="true"></script>
|
||||||
<script src="~/igniteui/js/infragistics.dv.js" type="text/javascript" asp-append-version="true"></script>
|
<script src="~/igniteui/js/infragistics.dv.js" type="text/javascript" asp-append-version="true"></script>
|
||||||
|
|
||||||
|
<script src="~/js/chart-4.3.0.min.js" type="module"></script>
|
||||||
|
|
||||||
<script src="~/js/common.js" type="text/javascript" asp-append-version="true"></script>
|
<script src="~/js/common.js" type="text/javascript" asp-append-version="true"></script>
|
||||||
<script src="~/js/site.js" type="text/javascript" asp-append-version="true"></script>
|
<script src="~/js/site.js" type="text/javascript" asp-append-version="true"></script>
|
||||||
<script>
|
<script>
|
||||||
|
13
Server/wwwroot/js/chart-3.9.1.min.js
vendored
Normal file
13
Server/wwwroot/js/chart-3.9.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
20
Server/wwwroot/js/chart-4.3.0.min.js
vendored
Normal file
20
Server/wwwroot/js/chart-4.3.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,3 +1,4 @@
|
|||||||
|
var _chart = null;
|
||||||
var _CdeId = null;
|
var _CdeId = null;
|
||||||
var _apiUrl = null;
|
var _apiUrl = null;
|
||||||
var _BioRadId = null;
|
var _BioRadId = null;
|
||||||
@ -232,6 +233,8 @@ function enableHeaderButtonsRunInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hideDetailsDivRunInfo() {
|
function hideDetailsDivRunInfo() {
|
||||||
|
if (_chart !== null)
|
||||||
|
_chart.destroy();
|
||||||
$("#DetailsDiv").prop("hidden", true);
|
$("#DetailsDiv").prop("hidden", true);
|
||||||
$("#DataAttachmentFrame").prop("src", "");
|
$("#DataAttachmentFrame").prop("src", "");
|
||||||
}
|
}
|
||||||
@ -245,19 +248,55 @@ function showDetailsDivRunInfo() {
|
|||||||
$("#OIExportResult").text('');
|
$("#OIExportResult").text('');
|
||||||
}
|
}
|
||||||
$("#DataAttachmentFrame").prop("hidden", true);
|
$("#DataAttachmentFrame").prop("hidden", true);
|
||||||
|
$("#DataAttachmentDiv").prop("hidden", true);
|
||||||
$("#HeaderAttachmentFrame").prop("hidden", true);
|
$("#HeaderAttachmentFrame").prop("hidden", true);
|
||||||
|
$("#HeaderAttachmentDiv").prop("hidden", true);
|
||||||
if (_toolType != null) {
|
if (_toolType != null) {
|
||||||
var visibleFrames = 0;
|
var visibleFrames = 0;
|
||||||
if (_toolType.DisplayDataAttachment && _toolType.DisplayDataAttachment.length > 0) {
|
if (_toolType.DisplayDataAttachment && _toolType.DisplayDataAttachment.length > 0) {
|
||||||
visibleFrames += 1;
|
if (!_toolType.DataGridAttributes || _toolType.DataGridAttributes.indexOf('div') === -1) {
|
||||||
$("#DataAttachmentFrame").prop("hidden", false);
|
visibleFrames += 1;
|
||||||
|
$("#DataAttachmentFrame").prop("hidden", false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$("#DataAttachmentDiv").prop("hidden", false);
|
||||||
}
|
}
|
||||||
if (_toolType.DisplayHeaderAttachment && _toolType.DisplayHeaderAttachment.length > 0) {
|
if (_toolType.DisplayHeaderAttachment && _toolType.DisplayHeaderAttachment.length > 0) {
|
||||||
visibleFrames += 1;
|
if (!_toolType.HeaderGridAttributes || _toolType.HeaderGridAttributes.indexOf('div') === -1) {
|
||||||
$("#HeaderAttachmentFrame").prop("hidden", false);
|
visibleFrames += 1;
|
||||||
|
$("#HeaderAttachmentFrame").prop("hidden", false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$("#HeaderAttachmentDiv").prop("hidden", false);
|
||||||
}
|
}
|
||||||
var frameWidth = (98 / visibleFrames) + "%";
|
var frameWidth = (98 / visibleFrames) + "%";
|
||||||
$("#DataAttachmentFrame,#HeaderAttachmentFrame").css('width', frameWidth);
|
$("#DataAttachmentFrame,#HeaderAttachmentFrame").css('width', frameWidth);
|
||||||
|
if (_toolType.DataGridAttributes != null) {
|
||||||
|
var dataGridAttributes = JSON.parse(_toolType.DataGridAttributes);
|
||||||
|
if (dataGridAttributes.frame) {
|
||||||
|
for (const property in dataGridAttributes.frame) {
|
||||||
|
$("#DataAttachmentFrame").css(property, dataGridAttributes.frame[property]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dataGridAttributes.div) {
|
||||||
|
for (const property in dataGridAttributes.div) {
|
||||||
|
$("#DataAttachmentDiv").css(property, dataGridAttributes.div[property]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_toolType.HeaderGridAttributes != null) {
|
||||||
|
var headerGridAttributes = JSON.parse(_toolType.HeaderGridAttributes);
|
||||||
|
if (headerGridAttributes.frame) {
|
||||||
|
for (const property in headerGridAttributes.frame) {
|
||||||
|
$("#HeaderAttachmentFrame").css(property, headerGridAttributes.frame[property]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (headerGridAttributes.div) {
|
||||||
|
for (const property in headerGridAttributes.div) {
|
||||||
|
$("#HeaderAttachmentDiv").css(property, headerGridAttributes.div[property]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,31 +321,265 @@ function cancelHandlerRunInfo(evt, ui) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GetMinMax(profilePoints, index) {
|
||||||
|
var cd;
|
||||||
|
var depth;
|
||||||
|
var edited;
|
||||||
|
var ceilingCD;
|
||||||
|
var resistivity;
|
||||||
|
var ceilingEdited;
|
||||||
|
var maxDepth = 30;
|
||||||
|
var ceilingResistivity;
|
||||||
|
var resistivityMin = 99;
|
||||||
|
var resistivityMax = -99;
|
||||||
|
var concentrationMin = 99;
|
||||||
|
var concentrationMax = -99;
|
||||||
|
var resistanceEditedMin = 99;
|
||||||
|
var resistanceEditedMax = -99;
|
||||||
|
for (var i = 0; i < profilePoints.length; i++) {
|
||||||
|
if (!profilePoints[i].Depth || !profilePoints[i].Edited || !profilePoints[i].Resistivity || !profilePoints[i].CD)
|
||||||
|
continue;
|
||||||
|
if (profilePoints[i].Edited.length < 1 || profilePoints[i].Resistivity.length < 1 || profilePoints[i].CD.length < 1)
|
||||||
|
continue;
|
||||||
|
depth = parseFloat(profilePoints[i].Depth);
|
||||||
|
if (depth <= 0 || profilePoints[i].Raw == 0)
|
||||||
|
continue;
|
||||||
|
if (index > 0) {
|
||||||
|
cd = parseFloat(profilePoints[i].CD);
|
||||||
|
edited = parseFloat(profilePoints[i].Edited);
|
||||||
|
resistivity = parseFloat(profilePoints[i].Resistivity);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cd = Math.log10(parseFloat(profilePoints[i].CD));
|
||||||
|
edited = Math.log10(parseFloat(profilePoints[i].Edited));
|
||||||
|
resistivity = Math.log10(parseFloat(profilePoints[i].Resistivity));
|
||||||
|
}
|
||||||
|
maxDepth = parseFloat(profilePoints[i].Depth);
|
||||||
|
if (resistivity < resistivityMin)
|
||||||
|
resistivityMin = resistivity;
|
||||||
|
ceilingResistivity = Math.ceil(resistivity);
|
||||||
|
if (ceilingResistivity > resistivityMax)
|
||||||
|
resistivityMax = ceilingResistivity;
|
||||||
|
if (edited < resistanceEditedMin)
|
||||||
|
resistanceEditedMin = edited;
|
||||||
|
ceilingEdited = Math.ceil(edited);
|
||||||
|
if (ceilingEdited > resistanceEditedMax)
|
||||||
|
resistanceEditedMax = ceilingEdited;
|
||||||
|
if (cd < concentrationMin)
|
||||||
|
concentrationMin = cd;
|
||||||
|
ceilingCD = Math.ceil(cd);
|
||||||
|
if (ceilingCD > concentrationMax)
|
||||||
|
concentrationMax = ceilingCD;
|
||||||
|
}
|
||||||
|
decades = resistivityMax - resistivityMin;
|
||||||
|
if (resistanceEditedMax - resistanceEditedMin > decades)
|
||||||
|
decades = resistanceEditedMax - resistanceEditedMin;
|
||||||
|
if (concentrationMax - concentrationMin > decades)
|
||||||
|
decades = concentrationMax - concentrationMin;
|
||||||
|
return { decades, maxDepth, concentrationMin, concentrationMax, resistanceEditedMin, resistanceEditedMax, resistivityMin, resistivityMax };
|
||||||
|
}
|
||||||
|
|
||||||
|
function setChart(index, ctx, data) {
|
||||||
|
var cd;
|
||||||
|
var depth;
|
||||||
|
var edited;
|
||||||
|
var resistivity;
|
||||||
|
var depthCollection = [];
|
||||||
|
var rawCollection = []; // Black
|
||||||
|
var resistivityCollection = []; // Green
|
||||||
|
var concentrationCollection = []; // Blue
|
||||||
|
var resistanceEditedCollection = []; // Red
|
||||||
|
var yType = index > 0 ? 'linear' : 'logarithmic';
|
||||||
|
// var resistivity = [{ x: 10, y: 20 }, { x: 15, y: null }, { x: 20, y: 10 }];
|
||||||
|
var profilePoints = data.ProfileHeader.ProfilePoints;
|
||||||
|
var minMax = GetMinMax(profilePoints, index);
|
||||||
|
for (var i = 0; i < profilePoints.length; i++) {
|
||||||
|
if (!profilePoints[i].Depth || !profilePoints[i].Edited || !profilePoints[i].Resistivity || !profilePoints[i].CD)
|
||||||
|
continue;
|
||||||
|
if (profilePoints[i].Edited.length < 1 || profilePoints[i].Resistivity.length < 1 || profilePoints[i].CD.length < 1)
|
||||||
|
continue;
|
||||||
|
depth = parseFloat(profilePoints[i].Depth);
|
||||||
|
if (depth <= 0 || profilePoints[i].Raw == 0)
|
||||||
|
continue;
|
||||||
|
cd = parseFloat(profilePoints[i].CD);
|
||||||
|
raw = parseFloat(profilePoints[i].Raw);
|
||||||
|
edited = parseFloat(profilePoints[i].Edited);
|
||||||
|
resistivity = parseFloat(profilePoints[i].Resistivity);
|
||||||
|
if (cd === 0 || edited === 0 || resistivity === 0)
|
||||||
|
continue;
|
||||||
|
if (edited == 0 || resistivity == 0 || cd == 0)
|
||||||
|
continue;
|
||||||
|
depthCollection.push(depth);
|
||||||
|
if (index > 0) {
|
||||||
|
rawCollection.push(raw);
|
||||||
|
concentrationCollection.push(cd);
|
||||||
|
resistivityCollection.push(resistivity);
|
||||||
|
resistanceEditedCollection.push(edited);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rawCollection.push(Math.log10(raw));
|
||||||
|
concentrationCollection.push(Math.log10(cd));
|
||||||
|
resistivityCollection.push(Math.log10(resistivity));
|
||||||
|
resistanceEditedCollection.push(Math.log10(edited));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var chartOptions = {
|
||||||
|
plugins: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: yType,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
x: {
|
||||||
|
display: true,
|
||||||
|
position: 'bottom',
|
||||||
|
grid: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Depth (µm)',
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
raw: {
|
||||||
|
type: yType,
|
||||||
|
display: true,
|
||||||
|
position: 'left',
|
||||||
|
min: minMax.resistanceEditedMin,
|
||||||
|
max: minMax.resistanceEditedMax,
|
||||||
|
grid: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Resistance (Ω ohm)',
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
resistanceEdited: {
|
||||||
|
type: yType,
|
||||||
|
display: true,
|
||||||
|
position: 'left',
|
||||||
|
min: minMax.resistanceEditedMin,
|
||||||
|
max: minMax.resistanceEditedMax,
|
||||||
|
grid: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Resistance Edited (Ω ohm)',
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
resistivity: {
|
||||||
|
type: yType,
|
||||||
|
display: true,
|
||||||
|
position: 'left',
|
||||||
|
min: minMax.resistivityMin,
|
||||||
|
max: minMax.resistivityMax,
|
||||||
|
grid: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Resistivity (ρ ohm-cm)',
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
concentration: {
|
||||||
|
type: yType,
|
||||||
|
display: true,
|
||||||
|
position: 'right',
|
||||||
|
min: minMax.concentrationMin,
|
||||||
|
max: minMax.concentrationMax,
|
||||||
|
grid: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'CD (1/cm³)',
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_chart = new Chart(ctx, {
|
||||||
|
type: 'line',
|
||||||
|
data: {
|
||||||
|
labels: depthCollection,
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
fill: false,
|
||||||
|
yAxisID: "resistivity",
|
||||||
|
borderColor: 'rgb(0, 255, 0)',
|
||||||
|
backgroundColor: 'rgba(0, 255, 0, 1)',
|
||||||
|
label: 'Resistivity (ρ ohm-cm)',
|
||||||
|
data: resistivityCollection
|
||||||
|
}, {
|
||||||
|
fill: false,
|
||||||
|
yAxisID: "resistanceEdited",
|
||||||
|
borderColor: 'rgb(255, 0, 0)',
|
||||||
|
backgroundColor: 'rgba(255, 0, 0, 1)',
|
||||||
|
label: 'Resistance Edited (Ω ohm)',
|
||||||
|
data: resistanceEditedCollection
|
||||||
|
}, {
|
||||||
|
fill: false,
|
||||||
|
yAxisID: "raw",
|
||||||
|
borderColor: 'rgb(0, 0, 0)',
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 1)',
|
||||||
|
label: 'Resistance (Ω ohm)',
|
||||||
|
data: rawCollection
|
||||||
|
}, {
|
||||||
|
fill: false,
|
||||||
|
yAxisID: "concentration",
|
||||||
|
borderColor: 'rgb(0, 0, 255)',
|
||||||
|
backgroundColor: 'rgba(0, 0, 255, 1)',
|
||||||
|
label: 'CD (1/cm³)',
|
||||||
|
data: concentrationCollection
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
options: chartOptions,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function detailSelectionChangedRunInfo(evt, ui) {
|
function detailSelectionChangedRunInfo(evt, ui) {
|
||||||
$("#DataAttachmentFrame").prop("src", "");
|
if (_chart !== null)
|
||||||
if (ui.row.index >= 0) {
|
_chart.destroy();
|
||||||
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
var toolTypeID = $("#ToolTypeID").text();
|
||||||
var toolTypeID = $("#ToolTypeID").text();
|
var headerAttachmentId = $("#HeaderAttachmentId").text();
|
||||||
var attachmentUrlBase = _apiUrl + '/tooltypes/' + toolTypeID;
|
var attachmentUrlBase = _apiUrl + '/tooltypes/' + toolTypeID;
|
||||||
var attachmentId = rowData.AttachmentID;
|
if (!headerAttachmentId || headerAttachmentId === '' || !_toolType.DataGridAttributes || _toolType.DataGridAttributes.indexOf('div') === -1) {
|
||||||
if ((attachmentId == null) || (attachmentId === ''))
|
$("#DataAttachmentFrame").prop("src", "");
|
||||||
return;
|
if (ui.row.index >= 0) {
|
||||||
if ((_toolType.DisplayDataAttachment == null) || (_toolType.DisplayDataAttachment === ''))
|
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
||||||
return;
|
var attachmentId = rowData.AttachmentID;
|
||||||
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + _toolType.DisplayDataAttachment);
|
if ((attachmentId == null) || (attachmentId === ''))
|
||||||
|
return;
|
||||||
|
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + _toolType.DisplayDataAttachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var ctx = document.getElementById('DataAttachmentCanvas');
|
||||||
|
$.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) {
|
||||||
|
setChart(ui.row.index, ctx, data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadHeaderAttachmentRunInfo() {
|
function loadHeaderAttachmentRunInfo() {
|
||||||
|
if (_chart !== null)
|
||||||
|
_chart.destroy();
|
||||||
var toolTypeID = $("#ToolTypeID").text();
|
var toolTypeID = $("#ToolTypeID").text();
|
||||||
|
$("#DataAttachmentFrame").prop("src", "");
|
||||||
var attachmentId = $("#HeaderAttachmentId").text();
|
var attachmentId = $("#HeaderAttachmentId").text();
|
||||||
var attachmentUrlBase = _apiUrl + '/tooltypes/' + toolTypeID;
|
|
||||||
if ((attachmentId == null) || (attachmentId === '') || (_toolType.DisplayHeaderAttachment == null) || (_toolType.DisplayHeaderAttachment === '')) {
|
if ((attachmentId == null) || (attachmentId === '') || (_toolType.DisplayHeaderAttachment == null) || (_toolType.DisplayHeaderAttachment === '')) {
|
||||||
$("#HeaderAttachmentFrame").prop("src", "");
|
$("#HeaderAttachmentFrame").prop("src", "");
|
||||||
} else {
|
} else {
|
||||||
$("#HeaderAttachmentFrame").prop("src", attachmentUrlBase + "/header/files/" + attachmentId + "/" + _toolType.DisplayHeaderAttachment);
|
if (!_toolType.HeaderGridAttributes || _toolType.HeaderGridAttributes.indexOf('frame') === -1 || _toolType.HeaderGridAttributes.indexOf('controller') === -1)
|
||||||
|
$("#HeaderAttachmentFrame").prop("src", _apiUrl + '/tooltypes/' + toolTypeID + "/header/files/" + attachmentId + "/" + _toolType.DisplayHeaderAttachment);
|
||||||
|
else {
|
||||||
|
var headerGridAttributes = JSON.parse(_toolType.HeaderGridAttributes);
|
||||||
|
$("#HeaderAttachmentFrame").prop("src", _apiUrl + '/' + headerGridAttributes.frame.controller + '/' + toolTypeID + "/header/files/" + attachmentId + "/" + _toolType.DisplayHeaderAttachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$("#DataAttachmentFrame").prop("src", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function markAsReviewedRunInfo() {
|
function markAsReviewedRunInfo() {
|
||||||
@ -324,18 +597,53 @@ function markAsReviewedRunInfo() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copySelected(attachmentID, title, data) {
|
||||||
|
var allText = "";
|
||||||
|
var headerText = "";
|
||||||
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
|
if (selectedRow !== null) {
|
||||||
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
|
for (const property in rowData) {
|
||||||
|
if (property === "ID" || property === attachmentID || property === title)
|
||||||
|
continue;
|
||||||
|
allText = allText + property + '\t';
|
||||||
|
headerText = headerText + rowData[property] + '\t';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = 0; i < data.Results.length; i++) {
|
||||||
|
if (i === 0) {
|
||||||
|
for (const property in data.Results[i]) {
|
||||||
|
if (property === "ID" || property === "InsertDate" || property === attachmentID || property === title)
|
||||||
|
continue;
|
||||||
|
allText = allText + property + '\t';
|
||||||
|
}
|
||||||
|
allText = allText + '\r';
|
||||||
|
}
|
||||||
|
allText = allText + headerText;
|
||||||
|
for (const property in data.Results[i]) {
|
||||||
|
if (property === "ID" || property === "InsertDate" || property === attachmentID || property === title)
|
||||||
|
continue;
|
||||||
|
allText = allText + data.Results[i][property] + '\t';
|
||||||
|
}
|
||||||
|
allText = allText + '\r';
|
||||||
|
}
|
||||||
|
copy(allText);
|
||||||
|
}
|
||||||
|
|
||||||
function loadDetailsRunInfo() {
|
function loadDetailsRunInfo() {
|
||||||
showDetailsDivRunInfo();
|
showDetailsDivRunInfo();
|
||||||
loadHeaderAttachmentRunInfo();
|
loadHeaderAttachmentRunInfo();
|
||||||
var gridCreated = $("#DetailsGrid").data("igGrid");
|
var gridCreated = $("#DetailsGrid").data("igGrid");
|
||||||
if (gridCreated)
|
if (gridCreated)
|
||||||
$("#DetailsGrid").igGrid("destroy");
|
$("#DetailsGrid").igGrid("destroy");
|
||||||
|
var title = "Title";
|
||||||
|
var attachmentID = "AttachmentID";
|
||||||
var headerId = $("#HeaderId").text();
|
var headerId = $("#HeaderId").text();
|
||||||
var toolTypeID = $("#ToolTypeID").text();
|
var toolTypeID = $("#ToolTypeID").text();
|
||||||
var detailsURL = _apiUrl + "/tooltypes/" + toolTypeID + "/headers/" + headerId + "/data";
|
var detailsURL = _apiUrl + "/tooltypes/" + toolTypeID + "/headers/" + headerId + "/data";
|
||||||
var gridColumns = [
|
var gridColumns = [
|
||||||
{ key: "AttachmentID", dataType: "string", hidden: true },
|
{ key: attachmentID, dataType: "string", hidden: true },
|
||||||
{ key: "Title", dataType: "string", hidden: true },
|
{ key: title, dataType: "string", hidden: true },
|
||||||
];
|
];
|
||||||
for (var i = 0; i < _toolTypeMetaData.length; i++) {
|
for (var i = 0; i < _toolTypeMetaData.length; i++) {
|
||||||
var f = _toolTypeMetaData[i];
|
var f = _toolTypeMetaData[i];
|
||||||
@ -356,23 +664,29 @@ function loadDetailsRunInfo() {
|
|||||||
gridColumns.push(col);
|
gridColumns.push(col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var gridParms = {
|
$.getJSON(detailsURL, function (data) {
|
||||||
autoGenerateColumns: false,
|
var gridParms = {
|
||||||
primaryKey: "ID",
|
autoGenerateColumns: false,
|
||||||
features: [
|
primaryKey: "ID",
|
||||||
{ name: "Selection", mode: "row", rowSelectionChanging: detailSelectionChangedRunInfo },
|
features: [
|
||||||
{ name: "Resizing" },
|
{ name: "Selection", mode: "row", rowSelectionChanging: detailSelectionChangedRunInfo },
|
||||||
{ name: "Sorting", type: "local" }
|
{ name: "Resizing" },
|
||||||
],
|
{ name: "Sorting", type: "local" }
|
||||||
columns: gridColumns,
|
],
|
||||||
dataSource: detailsURL,
|
columns: gridColumns,
|
||||||
responseDataKey: "Results",
|
dataSource: data,
|
||||||
dataBound: markAsReviewedRunInfo,
|
dataSourceType: 'json',
|
||||||
};
|
responseDataKey: "Results",
|
||||||
if ((_toolType != null) && (_toolType.DataGridAttributes != null)) {
|
dataBound: markAsReviewedRunInfo,
|
||||||
jQuery.extend(gridParms, JSON.parse(_toolType.DataGridAttributes));
|
};
|
||||||
}
|
if ((_toolType != null) && (_toolType.DataGridAttributes != null)) {
|
||||||
$("#DetailsGrid").igGrid(gridParms);
|
jQuery.extend(gridParms, JSON.parse(_toolType.DataGridAttributes));
|
||||||
|
}
|
||||||
|
$("#DetailsGrid").igGrid(gridParms);
|
||||||
|
if ($("#chkCopyOnGet").is(':checked')) {
|
||||||
|
copySelected(attachmentID, title, data);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestHeaderDataRunInfo() {
|
function requestHeaderDataRunInfo() {
|
||||||
@ -396,6 +710,10 @@ function requestHeaderDataRunInfo() {
|
|||||||
$("#HeaderAttachmentId").text(_initialHeaderAttachmentId);
|
$("#HeaderAttachmentId").text(_initialHeaderAttachmentId);
|
||||||
_initialHeaderId = -1;
|
_initialHeaderId = -1;
|
||||||
}
|
}
|
||||||
|
if (!_toolType.DataGridAttributes || _toolType.DataGridAttributes.indexOf('pinButton') === -1)
|
||||||
|
$("#PinButton").hide();
|
||||||
|
else
|
||||||
|
$("#PinButton").show();
|
||||||
var headerURL = _apiUrl + "/tooltypes/" + _toolType.ID + "/headers?" + $.param(parms);
|
var headerURL = _apiUrl + "/tooltypes/" + _toolType.ID + "/headers?" + $.param(parms);
|
||||||
var gridColumns = [
|
var gridColumns = [
|
||||||
{ key: "ID", dataType: "number", hidden: true },
|
{ key: "ID", dataType: "number", hidden: true },
|
||||||
@ -790,12 +1108,14 @@ function initIndex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function copy(copyText) {
|
function copy(copyText) {
|
||||||
// Select the text field
|
if (typeof copyText.select !== "undefined")
|
||||||
copyText.select();
|
copyText.select();
|
||||||
copyText.setSelectionRange(0, 99999); // For mobile devices
|
if (typeof copyText.setSelectionRange !== "undefined")
|
||||||
|
copyText.setSelectionRange(0, 99999); // For mobile devices
|
||||||
// Copy the text inside the text field
|
if (typeof copyText.value !== "undefined")
|
||||||
navigator.clipboard.writeText(copyText.value);
|
navigator.clipboard.writeText(copyText.value);
|
||||||
|
else
|
||||||
|
navigator.clipboard.writeText(copyText);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearWorkMaterial() {
|
function clearWorkMaterial() {
|
||||||
@ -935,4 +1255,7 @@ function runDataSheet(runDataSheetIndex) {
|
|||||||
|
|
||||||
function restartButton(apiUrl) {
|
function restartButton(apiUrl) {
|
||||||
clearWorkMaterial();
|
clearWorkMaterial();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// { "frame": { "controller": "SpreadingResistanceProfile", "height": "718px", "width": "698px" } }
|
||||||
|
// { "div": { "width": "698px", "position": "absolute", "top":"700px", "left": "800px" }, "height": "160px" }
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface ISpreadingResistanceProfileController<T>
|
||||||
|
{
|
||||||
|
|
||||||
|
enum Action : int
|
||||||
|
{
|
||||||
|
Index = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
static string GetRouteName() => nameof(ISpreadingResistanceProfileController<T>)[1..^10];
|
||||||
|
T GetAttachment(int toolTypeId, string tabletype, string attachmentId, string filename);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface ISpreadingResistanceProfileService
|
||||||
|
{
|
||||||
|
|
||||||
|
byte[] GetImageBytes(string json);
|
||||||
|
byte[] GetImageBytes(Stream stream);
|
||||||
|
|
||||||
|
}
|
@ -33,10 +33,10 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.12.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
|
67
Tests/UnitTestISpreadingResistanceProfileController.cs
Normal file
67
Tests/UnitTestISpreadingResistanceProfileController.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
|
[TestClass]
|
||||||
|
public class UnitTestISpreadingResistanceProfileController
|
||||||
|
{
|
||||||
|
|
||||||
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
|
private static ILogger _Logger;
|
||||||
|
private static string _ControllerName;
|
||||||
|
private static TestContext _TestContext;
|
||||||
|
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
|
||||||
|
[ClassInitialize]
|
||||||
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
|
{
|
||||||
|
_TestContext = testContext;
|
||||||
|
_Logger = Log.ForContext<UnitTestISpreadingResistanceProfileController>();
|
||||||
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
_ControllerName = nameof(Server.ApiControllers.InfinityQSController)[..^10];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void NonThrowTryCatch()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{ throw new Exception(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestControllerName()
|
||||||
|
{
|
||||||
|
_Logger.Information("Starting Web Application");
|
||||||
|
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
|
||||||
|
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetSpreadingResistanceProfileServiceImageBytes()
|
||||||
|
{
|
||||||
|
_Logger.Information("Starting Web Application");
|
||||||
|
string directory = "D:/wwwRoot";
|
||||||
|
if (!Directory.Exists(directory))
|
||||||
|
_ = Directory.CreateDirectory(directory);
|
||||||
|
string file = Path.Combine(directory, "data.json");
|
||||||
|
if (File.Exists(file))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(file);
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
ISpreadingResistanceProfileService spreadingResistanceProfileService = serviceProvider.GetRequiredService<ISpreadingResistanceProfileService>();
|
||||||
|
byte[] bytes = spreadingResistanceProfileService.GetImageBytes(json);
|
||||||
|
Assert.IsTrue(bytes.Any());
|
||||||
|
File.WriteAllBytes(Path.Combine(directory, "srp.png"), bytes);
|
||||||
|
}
|
||||||
|
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -31,6 +31,13 @@ public class UnitTestToolTypesController
|
|||||||
_ControllerName = nameof(Server.ApiControllers.ToolTypesController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.ToolTypesController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void NonThrowTryCatch()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{ throw new Exception(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MudBlazor" Version="6.2.2" />
|
<PackageReference Include="MudBlazor" Version="6.2.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.5" />
|
||||||
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
|
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||||
|
@ -40,7 +40,7 @@ steps:
|
|||||||
displayName: Configuration
|
displayName: Configuration
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
set nugetSource=https://messa017.infineon.com/v3/index.json
|
set nugetSource=https://eaf-dev-reporting.mes.infineon.com/v3/index.json
|
||||||
echo %nugetSource%
|
echo %nugetSource%
|
||||||
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
||||||
echo $(NugetSource)
|
echo $(NugetSource)
|
||||||
|
@ -52,7 +52,7 @@ stages:
|
|||||||
displayName: Configuration
|
displayName: Configuration
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
set nugetSource=https://messa017.infineon.com/v3/index.json
|
set nugetSource=https://eaf-dev-reporting.mes.infineon.com/v3/index.json
|
||||||
echo %nugetSource%
|
echo %nugetSource%
|
||||||
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
||||||
echo $(NugetSource)
|
echo $(NugetSource)
|
||||||
|
Reference in New Issue
Block a user