notihg to commit

This commit is contained in:
Roland Drabesch
2025-04-09 09:48:37 +02:00
574 changed files with 267 additions and 317671 deletions
+1 -1
View File
@@ -14,4 +14,4 @@ using System.Reflection;
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.6.13.*")]
[assembly: AssemblyVersion("2.6.15.*")]
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\LAA_PRODUCTION\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
+3 -1
View File
@@ -40,7 +40,9 @@
<Reference Include="GLWpfControl, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.GLWpfControl.3.3.0\lib\net452\GLWpfControl.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=3.3.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll</HintPath>
</Reference>
+2 -2
View File
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using ScottPlot.WPF;
using ScottPlot.WPF;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -7,6 +6,7 @@ using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
+1
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="OpenTK" version="3.3.1" targetFramework="net48" />
<package id="OpenTK.GLWpfControl" version="3.3.0" targetFramework="net48" />
<package id="ScottPlot" version="5.0.32" targetFramework="net48" />
@@ -184,7 +184,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="CordonelAssemblyLine_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -31,6 +31,7 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.EventArguments;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Properties;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisPwd;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol.Consts;
@@ -510,14 +511,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
nameof(Genesis), configFile);
if (!new FileInfo(configFilePath).Exists)
{
Logger.Fatal($"Slot:{Slot} - Missing register definition file (configuration.json). Search location: {configFilePath}");
throw new ApplicationException("Missing register definition file (configuration.json). Setup is invalid!");
var msg = $"Slot:{Slot} - {Resources.StrErrorMissingConfiguration} {location}";
Logger.Fatal($"Slot:{Slot} - Missing register definition file (configuration.json). Search location: {location}");
throw new ApplicationException(msg);
}
}
try
{
Logger.Trace($"Slot:{Slot} - Registers definitions loaded from {configFilePath}");
Logger.Trace($"Slot:{Slot} - Registers definitions loaded from {location}");
if (Configuration.AutoUpdateFiles)
{
Logger.Trace($"Slot:{Slot} - Check for updates of {configFilePath}");
@@ -815,9 +817,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
catch (Exception ex)
{
throw new ApplicationException("Cannot Open Comport. Check TaskManager for other Genesis " +
"relevant programs and close them. " +
$"Also check if the comport is valid! { Environment.NewLine }{ ex.Message}");
var msg = $"Slot:{Slot} - {Resources.StrErrorMsgComPort} { ex.Message}";
Logger.Fatal(msg);
throw new ApplicationException(msg);
}
protocol.OnRecordReadyToSend += delegate (Object o, BasePortDataEventArgs dataToSend)
@@ -60,6 +60,24 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to ERROR: Missing or invalid register definition (configuration.json)! Search in:.
/// </summary>
internal static string StrErrorMissingConfiguration {
get {
return ResourceManager.GetString("StrErrorMissingConfiguration", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot Open Comport. Check TaskManager for other Genesis relevant programs and close them! Also check if the comport is valid!.
/// </summary>
internal static string StrErrorMsgComPort {
get {
return ResourceManager.GetString("StrErrorMsgComPort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ERROR: Could not find a CSD parameter in register list!.
/// </summary>
@@ -186,4 +186,10 @@
<data name="StrErrorMsgRegisterWrite" xml:space="preserve">
<value>FEHLER: Register konnte nicht geschrieben werden!</value>
</data>
<data name="StrErrorMissingConfiguration" xml:space="preserve">
<value>FEHLER: Konfigurationsdatei (configuration.json) nicht gefunden oder ungültig! Erwartetes Verzeichnis:</value>
</data>
<data name="StrErrorMsgComPort" xml:space="preserve">
<value>Kommunikationsanschluß nicht vorhanden oder von anderer Genesis App blockiert! Bitte TaskManger starten und prüfen!</value>
</data>
</root>
@@ -186,4 +186,10 @@
<data name="StrErrorMsgRegisterWrite" xml:space="preserve">
<value>ERROR: Could not write register!</value>
</data>
<data name="StrErrorMissingConfiguration" xml:space="preserve">
<value>ERROR: Missing or invalid register definition (configuration.json)! Search in:</value>
</data>
<data name="StrErrorMsgComPort" xml:space="preserve">
<value>Cannot Open Comport. Check TaskManager for other Genesis relevant programs and close them! Also check if the comport is valid!</value>
</data>
</root>
@@ -1 +1 @@
e5e0833ba33456b07a9a7533c01344837e98dad9
7df2ad6be70922b931820861acc675522243ee78
@@ -37,11 +37,6 @@
<AutoGen>True</AutoGen>
<DependentUpon>FinalParamSequence_Write_Store_Reboot_Verify.feature</DependentUpon>
</Compile>
<Compile Update="Features\ProductionProcessCheckProductionState.feature.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>ProductionProcessCheckProductionState.feature</DependentUpon>
</Compile>
<Compile Update="Steps\CommonProductionProcessSteps.cs">
<SubType>Code</SubType>
</Compile>
@@ -61,7 +56,6 @@
</SpecFlowFeatureFiles>
<SpecFlowFeatureFiles Update="Features\ProductionProcessCheckProductionState.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>ProductionProcessCheckProductionState.feature.cs</LastGenOutput>
</SpecFlowFeatureFiles>
</ItemGroup>
@@ -646,9 +646,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
break;
case "ExecRebootCordonel":
registerName = "CUSTOMER_RebootCount";
var rebootCountBeforeReboot = RegisterConverter.ByteArrayToValue<UInt32>(
testCase.Meter.ReadRegister(registerName));
// Avoid reboot if failing is required
if (testCase.RequiredEOLProgress.RebootDoneChecked != EOLStatus.FAIL)
{
@@ -663,17 +660,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
testResult.StatusReturn = StatusReturn.Failed;
}
var rebootCountAfterReboot = RegisterConverter.ByteArrayToValue<UInt32>(
testCase.Meter.ReadRegister(registerName));
// The reboot counter will only be increased if reboot executed
if (rebootCountAfterReboot == rebootCountBeforeReboot)
{
testResult.StatusReturn = StatusReturn.Failed;
// Without reboot the RAM parameters are identical
paramsCheckWillSucceed = true;
}
if (string.IsNullOrEmpty(testResult.EOLProgress.ProductionStatusFwVersion))
testResult.EOLProgress.ProductionStatusFwVersion = testCase.Meter.FwVersion;
break;
@@ -64,33 +64,33 @@ namespace Xylem.Common.Production.ProductionUiCordonel
public FinalTest()
{
_logger = NLogHelper.CreateOrGetLogger("ProductionUICordonel");
_logger = NLogHelper.CreateOrGetLogger("ProductionUiCordonel");
Boolean access;
var msg = $"{Properties.Resources.StrStartMessageSwLicenseExpired}\n\n{_version}";
String msg;
try
{
// returns true in DEBUG configuration
access = Logic.SoftwareAccessHelper.Access.HasAccess(_assemblyName);
if (!Logic.SoftwareAccessHelper.Access.HasAccess(_assemblyName))
{
msg = $"{Properties.Resources.StrStartMessageSwLicenseExpired} {_version}";
_logger.Error(msg);
MessageBox.Show(msg, Properties.Resources.StrProcessStateError,
MessageBoxButton.OK, MessageBoxImage.Error);
Close();
return;
}
}
catch (Exception)
catch (Exception e)
{
_logger.Error(Properties.Resources.StrErrorMsgMissingNetworkConnetction);
MessageBox.Show(Properties.Resources.StrErrorMsgMissingNetworkConnetction,
msg = Properties.Resources.StrErrorMsgMissingNetworkConnetction + " " + e.Message ;
_logger.Error(msg);
MessageBox.Show(msg,
Properties.Resources.StrProcessStateError,
MessageBoxButton.OK, MessageBoxImage.Error);
Close();
return;
}
if (!access)
{
_logger.Error(msg);
MessageBox.Show(msg, Properties.Resources.StrProcessStateError, MessageBoxButton.OK, MessageBoxImage.Error);
Close();
return;
}
InitializeComponent();
// Log version to files for debug purposes
_strSoftwareNameVersion = $"{Properties.Resources.StrSoftwareNameVersion} {_version}";
@@ -141,7 +141,12 @@ namespace Xylem.Common.Production.ProductionUiCordonel
if (!File.Exists(configFile))
{
throw new ApplicationException($"Configuration file {configFile} not found ");
var msg = Properties.Resources.StrErrorMsgMissingConfigurationFile;
MessageBox.Show(msg,
Properties.Resources.StrProcessStateError,
MessageBoxButton.OK, MessageBoxImage.Error);
_logger.Error(msg);
throw new ApplicationException(msg);
}
var tr = new StreamReader(configFile);
var meterConfigList = JsonConvert.DeserializeObject<SlotConfig[]>(tr.ReadToEnd());
@@ -170,7 +175,18 @@ namespace Xylem.Common.Production.ProductionUiCordonel
Slot = slot;
}
_processCtrl = new FinalProcessController(Slot);
try
{
_processCtrl = new FinalProcessController(Slot);
}
catch (Exception ex)
{
_logger.Error(ex.Message);
MessageBox.Show(ex.Message,
Properties.Resources.StrProcessStateError,
MessageBoxButton.OK, MessageBoxImage.Error);
throw new ApplicationException(ex.Message);
}
//install the process changed event handler for single processes
_processCtrl.OnSingleProcessStateChanged += SingleProcessStateChanged_Handler;
@@ -401,33 +417,18 @@ namespace Xylem.Common.Production.ProductionUiCordonel
// Ready for shipping
if (e.State == ProcessState.ReadyForShipping)
{
// Update progress bars
ProcessProgress_Handler(this, new ProcessProgressArgs(0,
ProcessProgressArgs.ProcessProgressType.OverallProcessesSteps));
ProcessProgress_Handler(this, new ProcessProgressArgs(0,
ProcessProgressArgs.ProcessProgressType.ActualProcessSteps));
StoreSuccessNote(out _);
BtnStop_Click(this, null);
}
// Print return report
if (e.State == ProcessState.PrintReturnReport)
{
// Update progress bars
ProcessProgress_Handler(this, new ProcessProgressArgs(0,
ProcessProgressArgs.ProcessProgressType.OverallProcessesSteps));
ProcessProgress_Handler(this, new ProcessProgressArgs(0,
ProcessProgressArgs.ProcessProgressType.ActualProcessSteps));
PrintErrorNote();
BtnStop_Click(this, null);
}
// Print success report
if (e.State == ProcessState.PrintSuccessReport)
{
// Update progress bars
ProcessProgress_Handler(this, new ProcessProgressArgs(0,
ProcessProgressArgs.ProcessProgressType.OverallProcessesSteps));
ProcessProgress_Handler(this, new ProcessProgressArgs(0,
ProcessProgressArgs.ProcessProgressType.ActualProcessSteps));
PrintSuccessNote();
BtnStop_Click(this, null);
}
@@ -185,6 +185,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
#endregion --------------------------------------- Init -------------------------------------------------------
#region ------------------------------------------ Tools ------------------------------------------------------
/// <summary>
/// Set overall process to 100 %
/// </summary>
protected void SetOverallProcessTo100Percent()
{
OnProcessProgressChanged?.Invoke(this, new ProcessProgressArgs(Int32.MaxValue,
ProcessProgressArgs.ProcessProgressType.OverallProcessesSteps));
}
/// <inheritdoc/>
public UserControl GetUserControl()
{
@@ -3,8 +3,8 @@ using System.Collections.Generic;
using LaaPackages.Features.Cordonel.Models;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes;
using Xylem.Common.Logic.ProductionOrderCore;
//using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes;
//using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Production.ProductionUiCordonel.Properties;
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolProcesses
@@ -43,6 +43,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2025-Mar-31" author="Thomas Wiedebusch">
/// - Reset sensus radio and periodic log reset counters.
/// </remarks>
/// <remarks date="2025-Apr-03" author="Thomas Wiedebusch">
/// - Moved setting of time and reset counters from here to <see cref="ExecRebootCordonel"/>.
/// </remarks>
public override StatusReturn ExecuteProcess()
{
// Uncheck executed process to leave the result open needed for retries
@@ -73,37 +76,37 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
}
}
// Get the time in UTC to program the time for the Cordonel in seconds since 01. Jan 2000
// to set the new UTC after reboot
var teaTime = new TimeT();
// Build byte array
var rawSeconds = RegisterConverter.ValueToByteArray(teaTime.UtcNowToSecondsSince2000);
var timerSetup = new ProgrammingParameters("SYSTEM_CalendarSeconds", rawSeconds,
ProgrammingSource.ProgramInternal);
// This is the manufacturing date of the Cordonel
var irdaMfgDate = new ProgrammingParameters("IRDA_MfgDate", rawSeconds,
ProgrammingSource.ProgramInternal);
// Reset reboot counter
var nullRebootCtr = new ProgrammingParameters("CUSTOMER_RebootCount", new Byte[] { 0x00 },
ProgrammingSource.ProgramInternal);
var retValBol = WriteRegisterLogAndProcessCtr(timerSetup);
retValBol &= WriteRegisterLogAndProcessCtr(irdaMfgDate);
retValBol &= WriteRegisterLogAndProcessCtr(nullRebootCtr);
if (Meter.RadioFrequencyMhz != null)
{
// Reset periodic log reset counter
var periodicLogResetCtr = new ProgrammingParameters("PERIODICLOG_ResetCounter", new Byte[] { 0x00 },
ProgrammingSource.ProgramInternal);
retValBol &= WriteRegisterLogAndProcessCtr(periodicLogResetCtr);
// Reset sensus radio reset counter
var sensusRadioResetCtr = new ProgrammingParameters("SENSUSRADIO_ResetCounter", new Byte[] { 0x00 },
ProgrammingSource.ProgramInternal);
retValBol &= WriteRegisterLogAndProcessCtr(sensusRadioResetCtr);
}
//// Get the time in UTC to program the time for the Cordonel in seconds since 01. Jan 2000
//// to set the new UTC after reboot
//var teaTime = new TimeT();
//// Build byte array
//var rawSeconds = RegisterConverter.ValueToByteArray(teaTime.UtcNowToSecondsSince2000);
//var timerSetup = new ProgrammingParameters("SYSTEM_CalendarSeconds", rawSeconds,
// ProgrammingSource.ProgramInternal);
//// This is the manufacturing date of the Cordonel
//var irdaMfgDate = new ProgrammingParameters("IRDA_MfgDate", rawSeconds,
// ProgrammingSource.ProgramInternal);
//// Reset reboot counter
//var nullRebootCtr = new ProgrammingParameters("CUSTOMER_RebootCount", new Byte[] { 0x00 },
// ProgrammingSource.ProgramInternal);
//var retValBol = WriteRegisterLogAndProcessCtr(timerSetup);
//retValBol &= WriteRegisterLogAndProcessCtr(irdaMfgDate);
//retValBol &= WriteRegisterLogAndProcessCtr(nullRebootCtr);
//if (Meter.RadioFrequencyMhz != null)
//{
// // Reset periodic log reset counter
// var periodicLogResetCtr = new ProgrammingParameters("PERIODICLOG_ResetCounter", new Byte[] { 0x00 },
// ProgrammingSource.ProgramInternal);
// retValBol &= WriteRegisterLogAndProcessCtr(periodicLogResetCtr);
// // Reset sensus radio reset counter
// var sensusRadioResetCtr = new ProgrammingParameters("SENSUSRADIO_ResetCounter", new Byte[] { 0x00 },
// ProgrammingSource.ProgramInternal);
// retValBol &= WriteRegisterLogAndProcessCtr(sensusRadioResetCtr);
//}
// Execute final read after reboot
RegisterRestorer.OnProcessUpdate += ProcessUpdate_Handler;
retValBol &= RegisterRestorer.FinalReadRegisters();
var retValBol = RegisterRestorer.FinalReadRegisters();
retValBol &= RegisterRestorer.CompareRegisters();
RegisterRestorer.OnProcessUpdate -= ProcessUpdate_Handler;
@@ -125,10 +125,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
{
Retry();
};
_checkRadioUserControl.OnDoneRequested += delegate
{
SaveRssiLevelsToDb();
};
//_checkRadioUserControl.OnDoneRequested += delegate
//{
// SaveRssiLevelsToDb();
//};
}
/// <summary>
@@ -436,7 +436,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// </remarks>
private void DisableAllButtons()
{
EnableBtn(_checkRadioUserControl.btnSkip, false);
//EnableBtn(_checkRadioUserControl.btnSkip, false);
EnableBtn(_checkRadioUserControl.btnRetry, false);
}
@@ -726,7 +726,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
{
_dataContainer.Result = 0;
// done can finish the test which is equal to abort on error
EnableBtn(_checkRadioUserControl.btnSkip, true);
//EnableBtn(_checkRadioUserControl.btnSkip, true);
// reset can repeat the test as often as wanted
EnableBtn(_checkRadioUserControl.btnRetry, true);
_successSignalLevel = false;
@@ -2,6 +2,9 @@
using LaaPackages.Features.Cordonel.Models;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes;
using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum;
using Xylem.Common.Production.ProductionUiCordonel.Properties;
@@ -36,6 +39,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2024-Sep-05" author="Thomas Wiedebusch">
/// - EOL progress signaled.
/// </remarks>
/// <remarks date="2025-Apr-03" author="Thomas Wiedebusch">
/// - Moved setting of time and reset counters from <see cref="CheckFinalParametrization"/> to here.
/// </remarks>
public override StatusReturn ExecuteProcess()
{
// Uncheck executed process to leave the result open needed for retries
@@ -73,15 +79,60 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
var rebootSucceeded = _meterResetPsu.MeterResetPsuExecute();
_meterResetPsu.OnProcessUpdate -= ProcessUpdate_Handler;
if (rebootSucceeded)
if (!rebootSucceeded)
{
EolProgress.RebootDoneChecked = EOLStatus.OK;
return StatusReturn.Okay;
EolProgress.RebootDoneChecked = EOLStatus.FAIL;
return StatusReturn.Failed;
}
EolProgress.RebootDoneChecked = EOLStatus.FAIL;
return StatusReturn.Failed;
// access to meter requires login
if (!Meter.IsLoggedOn)
{
Meter.Login();
if (!Meter.IsLoggedOn)
{
ErrorMsgDispatcher(Resources.StrErrorMsgCordonelLogin);
EolProgress.RebootDoneChecked = EOLStatus.FAIL;
return StatusReturn.Failed;
}
}
// Get the time in UTC to program the time for the Cordonel in seconds since 01. Jan 2000
// to set the new UTC after reboot
var teaTime = new TimeT();
// Build byte array
var rawSeconds = RegisterConverter.ValueToByteArray(teaTime.UtcNowToSecondsSince2000);
var timerSetup = new ProgrammingParameters("SYSTEM_CalendarSeconds", rawSeconds,
ProgrammingSource.ProgramInternal);
// This is the manufacturing date of the Cordonel
var irdaMfgDate = new ProgrammingParameters("IRDA_MfgDate", rawSeconds,
ProgrammingSource.ProgramInternal);
// Reset reboot counter
var nullRebootCtr = new ProgrammingParameters("CUSTOMER_RebootCount", new Byte[] { 0x00 },
ProgrammingSource.ProgramInternal);
var retValBol = WriteRegisterLogAndProcessCtr(timerSetup);
retValBol &= WriteRegisterLogAndProcessCtr(irdaMfgDate);
retValBol &= WriteRegisterLogAndProcessCtr(nullRebootCtr);
if (Meter.RadioFrequencyMhz != null)
{
// Reset periodic log reset counter
var periodicLogResetCtr = new ProgrammingParameters("PERIODICLOG_ResetCounter", new Byte[] { 0x00 },
ProgrammingSource.ProgramInternal);
retValBol &= WriteRegisterLogAndProcessCtr(periodicLogResetCtr);
// Reset sensus radio reset counter
var sensusRadioResetCtr = new ProgrammingParameters("SENSUSRADIO_ResetCounter", new Byte[] { 0x00 },
ProgrammingSource.ProgramInternal);
retValBol &= WriteRegisterLogAndProcessCtr(sensusRadioResetCtr);
}
if (!retValBol)
{
EolProgress.RebootDoneChecked = EOLStatus.FAIL;
return StatusReturn.Failed;
}
EolProgress.RebootDoneChecked = EOLStatus.OK;
return StatusReturn.Okay;
}
catch (Exception ex)
{
@@ -144,11 +144,13 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
ucDialog.SetDialogOptions(OptionList);
ActualProcessProgress = MaxActualProgressSteps;
SetOverallProcessTo100Percent();
while (_waitOnUserFeedback && SingleProcessState != SingleProcessState.Idle)
{
}
ActualProcessProgress = MaxActualProgressSteps;
// Always use okay to kick off ForcedSuccessExitState
return StatusReturn.Okay;
}
@@ -510,6 +510,24 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Communication port is in use or not present. The software is going to exit!.
/// </summary>
internal static string StrErrorMsgMissingComPort {
get {
return ResourceManager.GetString("StrErrorMsgMissingComPort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Configuration file not found. Setup slot with the GenesisToolBox. The software is going to exit!.
/// </summary>
internal static string StrErrorMsgMissingConfigurationFile {
get {
return ResourceManager.GetString("StrErrorMsgMissingConfigurationFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ERROR: Not all EOL progresses succeeded.
/// </summary>
@@ -520,7 +538,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties {
}
/// <summary>
/// Looks up a localized string similar to Missing Network Connection. The software is going to exit..
/// Looks up a localized string similar to Missing Network Connection. The software is going to exit!.
/// </summary>
internal static string StrErrorMsgMissingNetworkConnetction {
get {
@@ -1510,7 +1528,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties {
}
/// <summary>
/// Looks up a localized string similar to New Cordonel - Delivery Preparation Software available! The software is going to exit..
/// Looks up a localized string similar to New Cordonel EOL Software available! The software is going to exit! This version:.
/// </summary>
internal static string StrStartMessageSwLicenseExpired {
get {
@@ -140,10 +140,16 @@
<value>..\Resources\CLEARMAtrix.JPG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="StrErrorMsgMissingNetworkConnetction" xml:space="preserve">
<value>Keine Verbindung zum Netzwerk. Die Software wird beendet.</value>
<value>Keine Verbindung zum Netzwerk. Die Software wird beendet!</value>
</data>
<data name="StrErrorMsgMissingConfigurationFile" xml:space="preserve">
<value>Konfigurationsdatei nicht gefunden. Slot muß mit der GenesisToolBox eingestellt werden! Die Software wird beendet!</value>
</data>
<data name="StrErrorMsgMissingComPort" xml:space="preserve">
<value>Kommunikationsanschluß ist belegt oder nicht vorhanden! Die Software wird beendet!</value>
</data>
<data name="StrStartMessageSwLicenseExpired" xml:space="preserve">
<value>Neue Cordonel Versandfertigmachen Software verfügbar! Die Software wird beendet.</value>
<value>Neue Cordonel VFM Software verfügbar! Die Software wird beendet! Diese version:</value>
</data>
<data name="StrStateIdle" xml:space="preserve">
<value>Warte</value>
@@ -140,10 +140,16 @@
<value>..\Resources\CLEARMAtrix.JPG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="StrErrorMsgMissingNetworkConnetction" xml:space="preserve">
<value>Missing Network Connection. The software is going to exit.</value>
<value>Missing Network Connection. The software is going to exit!</value>
</data>
<data name="StrErrorMsgMissingConfigurationFile" xml:space="preserve">
<value>Configuration file not found. Setup slot with the GenesisToolBox. The software is going to exit!</value>
</data>
<data name="StrErrorMsgMissingComPort" xml:space="preserve">
<value>Communication port is in use or not present. The software is going to exit!</value>
</data>
<data name="StrStartMessageSwLicenseExpired" xml:space="preserve">
<value>New Cordonel - Delivery Preparation Software available! The software is going to exit.</value>
<value>New Cordonel EOL Software available! The software is going to exit! This version:</value>
</data>
<data name="StrStateIdle" xml:space="preserve">
<value>Idle</value>
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Height="400" Width="250" Closing="Window_Closing" ResizeMode="NoResize" WindowStyle="SingleBorderWindow"
WindowStartupLocation="CenterScreen">
WindowStartupLocation="CenterScreen" Topmost="True">
<Grid Name="dgWinFormsHost" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
</Grid>
</Window>
@@ -35,7 +35,7 @@
<Label Name="lblRssiPamSirtDbMax" Content="-" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="3"/>
<Label Name="lblRssiSemiCordonelDbMax" Content="-" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="3" Grid.Column="3"/>
<Button Name="btnSkip" Content="Skip" Height="52" Width="96" Grid.Row="4" Grid.Column="0" Click="BtnSkip_Click" IsEnabled="False" />
<Button Name="btnRetry" Content="Retry" Height="52" Width="96" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" Click="btnReset_Click" IsEnabled="False" />
<!--Button Name="btnSkip" Content="Skip" Height="52" Width="96" Grid.Row="4" Grid.Column="0" Click="BtnSkip_Click" IsEnabled="False" /-->
<Button Name="btnRetry" Content="Retry" Height="52" Width="96" Grid.Row="4" Grid.Column="0" Click="btnReset_Click" IsEnabled="False" />
</Grid>
</UserControl>
@@ -123,7 +123,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UserControls.FinalTest
{
InitializeComponent();
lblHeadLine.Content = Properties.Resources.StrLblRadioCheck;
btnSkip.Content = Properties.Resources.StrBtnSkip;
//btnSkip.Content = Properties.Resources.StrBtnSkip;
btnRetry.Content = Properties.Resources.StrBtnRetry;
}
+5 -12
View File
@@ -25,7 +25,7 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
/// <returns></returns>
public static Boolean HasAccess(AssemblyName assemblyName)
{
return HasAccess(assemblyName.Name, assemblyName.Version.Major, assemblyName.Version.Minor,
return HasAccess(assemblyName.Name, assemblyName.Version.Major, assemblyName.Version.Minor,
assemblyName.Version.Build);
}
/// <summary>
@@ -43,18 +43,11 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
return true;
}
try
{
var url = $"{ServiceUrls.GetSoftwareStartUpAccessUrl()}?Program={program}&Major={major}&Minor={minor}&Build={build}";
var requestResponse = LocalWebRequest.GetRequest(url, 1200);
var url = $"{ServiceUrls.GetSoftwareStartUpAccessUrl()}?Program={program}&Major={major}&Minor={minor}&Build={build}";
var requestResponse = LocalWebRequest.GetRequest(url, 1200);
var ret = bool.Parse(requestResponse.Trim('"'));
return ret;
}
catch (Exception)
{
return false;
}
var ret = bool.Parse(requestResponse.Trim('"'));
return ret;
}
@@ -7,6 +7,7 @@ using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
namespace Xylem.Common.Logic.SoftwareAccessHelper
{
/// <summary>
@@ -96,7 +96,7 @@
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http">
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8.1\System.Net.Http.dll</HintPath>
<HintPath>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
@@ -1 +0,0 @@
22a4406eff6a4f32a04de21f6638112f36b1efc4
+16 -14
View File
@@ -1,4 +1,7 @@
namespace Xylem.Common.Ui.GenesisToolBox
using Xylem.Common.Ui.GenesisToolBox.Ctls;
using Xylem.Common.Ui.GenesisToolBox.Infrastructure;
namespace Xylem.Common.Ui.GenesisToolBox
{
using global::GenesisToolBox;
@@ -9,8 +12,6 @@
using System.Windows.Forms;
using CommonCore.Consts;
using Ctls;
using Infrastructure;
using Utils.Logging;
using System.Collections.Generic;
@@ -27,8 +28,8 @@
InitializeComponent();
InitializeFormState();
optionsMenuItem.Text = Software.UserName;
Text = $"{Text} {SoftwareVersion.Current.VersionString}";
menuItemOptions.Text = Software.UserName;
Text = $@"{Text} {SoftwareVersion.Current.VersionString}";
var logger = NLogHelper.CreateOrGetLogger("GenesisToolBox");
logger.Info($"GenesisToolBox {SoftwareVersion.Current}");
@@ -89,9 +90,8 @@
}
catch (Exception ex)
{
MessageBox.Show("GenesisToolBox\n\n" +
"Starting in OfflineMode\n\n" +
"Your version (NA) could not be verified!\n\n" +
MessageBox.Show(@"GenesisToolBox\n\n" +
@"Network Connection Error!\n\n" +
ex.Message);
Close();
@@ -107,8 +107,8 @@
}
if (!access)
{
MessageBox.Show("GenesisToolBox\n\n" +
"Your version licence is expired!\n\n" +
MessageBox.Show(@"GenesisToolBox\n\n" +
@"Your version licence is expired!\n\n" +
SoftwareVersion.Current);
Close();
@@ -304,7 +304,7 @@
private void btnLegacyTestApp_Click(Object sender, EventArgs e)
{
var form = new FrmManCalibration();
var form = new FrmLegacyTestApp();
form.Show();
form.Closed += Form_Closed;
Hide();
@@ -419,7 +419,9 @@
/// </summary>
private void SetSoftwareFunctions()
{
changePassword.Enabled = Software.IsAutenticated;
menuItemChangePwd.Enabled = Software.IsAutenticated;
menuItemLogout.Enabled = Software.IsAutenticated;
menuItemLogin.Enabled = !Software.IsAutenticated;
btnSetup.Tag = SoftwareFunctions.GENERAL_SETUP;
btnAlarm.Tag = SoftwareFunctions.GENERAL_ALARM;
@@ -452,7 +454,7 @@
Controls.Add(new Label()
{
Dock = DockStyle.Fill,
Text = "Genesis toolbox is currently not available.",
Text = @"Genesis toolbox is currently not available.",
TextAlign = ContentAlignment.MiddleCenter,
Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold),
ForeColor = Color.DarkRed,
@@ -496,7 +498,7 @@
}
}
optionsMenuItem.Text = Software.UserName;
menuItemOptions.Text = Software.UserName;
}
private void ShowAvailableMenuItems(ToolStripMenuItem toolStripMenuItem)
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Visual Studio Spell Checker configuration file - [https://github.com/EWSoftware/VSSpellChecker]
Do not edit the XML. Use the configuration file editor in Visual Studio to modify the settings. -->
<SpellCheckerConfiguration Format="2018.8.16.0" />
@@ -626,7 +626,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Properties\app.manifest" />
<None Include="FrmRegisterStore.Designer.cs.vsspell" />
<None Include="meterconfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+16 -14
View File
@@ -1,4 +1,7 @@
namespace Xylem.Common.Ui.GenesisToolBox
using Xylem.Common.Ui.GenesisToolBox.Ctls;
using Xylem.Common.Ui.GenesisToolBox.Infrastructure;
namespace Xylem.Common.Ui.GenesisToolBox
{
using global::GenesisToolBox;
@@ -9,8 +12,6 @@
using System.Windows.Forms;
using CommonCore.Consts;
using Ctls;
using Infrastructure;
using Utils.Logging;
using System.Collections.Generic;
@@ -27,8 +28,8 @@
InitializeComponent();
InitializeFormState();
optionsMenuItem.Text = Software.UserName;
Text = $"{Text} {SoftwareVersion.Current.VersionString}";
menuItemOptions.Text = Software.UserName;
Text = $@"{Text} {SoftwareVersion.Current.VersionString}";
var logger = NLogHelper.CreateOrGetLogger("GenesisToolBox");
logger.Info($"GenesisToolBox {SoftwareVersion.Current}");
@@ -89,9 +90,8 @@
}
catch (Exception ex)
{
MessageBox.Show("GenesisToolBox\n\n" +
"Starting in OfflineMode\n\n" +
"Your version (NA) could not be verified!\n\n" +
MessageBox.Show(@"GenesisToolBox\n\n" +
@"Network Connection Error!\n\n" +
ex.Message);
Close();
@@ -107,8 +107,8 @@
}
if (!access)
{
MessageBox.Show("GenesisToolBox\n\n" +
"Your version licence is expired!\n\n" +
MessageBox.Show(@"GenesisToolBox\n\n" +
@"Your version licence is expired!\n\n" +
SoftwareVersion.Current);
Close();
@@ -304,7 +304,7 @@
private void btnLegacyTestApp_Click(Object sender, EventArgs e)
{
var form = new FrmManCalibration();
var form = new FrmLegacyTestApp();
form.Show();
form.Closed += Form_Closed;
Hide();
@@ -419,7 +419,9 @@
/// </summary>
private void SetSoftwareFunctions()
{
changePassword.Enabled = Software.IsAutenticated;
menuItemChangePwd.Enabled = Software.IsAutenticated;
menuItemLogout.Enabled = Software.IsAutenticated;
menuItemLogin.Enabled = !Software.IsAutenticated;
btnSetup.Tag = SoftwareFunctions.GENERAL_SETUP;
btnAlarm.Tag = SoftwareFunctions.GENERAL_ALARM;
@@ -452,7 +454,7 @@
Controls.Add(new Label()
{
Dock = DockStyle.Fill,
Text = "Genesis toolbox is currently not available.",
Text = @"Genesis toolbox is currently not available.",
TextAlign = ContentAlignment.MiddleCenter,
Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold),
ForeColor = Color.DarkRed,
@@ -496,7 +498,7 @@
}
}
optionsMenuItem.Text = Software.UserName;
menuItemOptions.Text = Software.UserName;
}
private void ShowAvailableMenuItems(ToolStripMenuItem toolStripMenuItem)
Binary file not shown.
@@ -1,467 +0,0 @@
namespace LaaProduction.Data.Cordonel
{
public partial class CordonelDbContext
{
/// <summary>
/// Contains placeholder for the pcbId variable name at positon: 0
/// </summary>
private const string ALL_PRODUCTION_DATA_BY_PCB = @"
SELECT DISTINCT
aap.AuftragNr
, aap.PositionNr
, aap.FertigungsauftragNr
, aap.IdentNr
, idn.Charcode
, ms.Dn_Name
, ms.Dn_InternalId
, aps.KundeneigeneSerienNr
, aps.SerienNr
, pcb.PcbId
, gm.Adresse
, aps.Pruefgangnr
, aps.StatusFertigung
, CASE WHEN fs.Charcode = 'X'
THEN 'None'
WHEN fs.Charcode = '1'
THEN 'Standard'
WHEN fs.Charcode = '2'
THEN 'Random'
WHEN fs.Charcode = '3'
THEN 'CSD'
END AS EncryptionKeyKind
FROM CordonelMapPcbToAssignedPicking AS pcb
LEFT JOIN AlleAuftragPositionen AS aap
ON pcb.FertigungsauftragNr = aap.FertigungsauftragNr
LEFT JOIN AuftragPositionSerienNrByMaxStatusFertigung AS aps
ON aps.SerienNr = pcb.SerienNr
LEFT JOIN Genesis_Meter AS gm
ON aps.SerienNr = gm.Seriennummer
LEFT JOIN AlleIdentNrVakoMerkmale AS idn
ON aap.IdentNr = idn.IdentNr
AND idn.Stelle = 4
AND idn.Laenge = 2
LEFT JOIN AlleIdentNrVakoMerkmale AS fs
ON aap.IdentNr = fs.IdentNr
AND fs.Stelle = 46
AND fs.Laenge = 1
LEFT JOIN CordonelMeterSizes AS ms
ON idn.Charcode = ms.Dn_VakoID
WHERE pcb.PcbId = @{0}
ORDER BY aps.Pruefgangnr DESC";
/// <summary>
/// Contains placeholder for the pcbId at positon: 0
/// Contains placeholder for the FW version at positon: 1
/// </summary>
private const string APPS_VERSIONS_CRC_BY_PCB_V = @"
---------------------------------------------------------------------------------------------------
-- Declarations
---------------------------------------------------------------------------------------------------
DECLARE @pcbIdVarchar AS VARCHAR(20) = @{0};
DECLARE @fwVersion AS VARCHAR(20) = @{1};
DECLARE @progressId AS INT;
DECLARE @frequency AS INT;
DECLARE @meterSize AS INT;
---------------------------------------------------------------------------------------------------
-- Find and set latest progress id
---------------------------------------------------------------------------------------------------
SELECT @progressId = MAX(Id)
FROM CordonelProgress
WHERE PcbId = @pcbIdVarchar
---------------------------------------------------------------------------------------------------
-- Find and set meter size and frequency
---------------------------------------------------------------------------------------------------
SELECT @frequency = (SELECT TOP 1 CASE WHEN idn.Charcode = 'A'
THEN 868
WHEN idn.Charcode = 'B'
THEN 433
ELSE 0 END
FROM AlleIdentNrVakoMerkmale AS idn
WHERE idn.IdentNr = aap.IdentNr
AND idn.Stelle = 43
ORDER BY idn.Stelle)
, @meterSize = (SELECT TOP 1 cms.Dn_InternalId
FROM AlleIdentNrVakoMerkmale AS idn
JOIN CordonelMeterSizes AS cms
ON idn.Charcode = cms.Dn_VakoID
WHERE idn.IdentNr = aap.IdentNr
AND idn.Stelle = 4
ORDER BY idn.Stelle)
FROM MapPcbIdToSerialNumber AS map
JOIN AuftragPositionSerienNr AS aps
ON map.MapPcbIdToSerialNumber_SerialNumber = aps.SerienNr
JOIN AlleAuftragPositionen AS aap
ON aps.AuftragNr = aap.AuftragNr
AND aps.PositionNr = aap.PositionNr
WHERE map.MapPcbIdToSerialNumber_PcbId = @pcbIdVarchar
---------------------------------------------------------------------------------------------------
-- Select all apps with their versions and crc
---------------------------------------------------------------------------------------------------
SELECT DISTINCT
apps.PcbId AS AppsPcbId
, apps.AppId AS AppsAppId
, apps.Version AS AppsAppVersion
, history.PcbId AS HistoryPcbId
, history.HistoryAppVersion
, history.HistoryAppCrc
, files.FlexnetAppId
, files.FlexnetVersion
, files.MetrologyVersion
, files.CoreRevisionMin
, files.CoreRevisionMax
, files.FilesAppId
, files.FilesAppVersion
, files.FilesAppCrc
, files.ClusterFileId
, files.FileName
FROM (SELECT _progress.PcbId
, RIGHT(CONVERT(VARCHAR(10), CONVERT(BINARY(1), _apps.AppId, 2), 2), 2) AS AppId
, CASE WHEN LEN(_apps.Version) >= 4
THEN RIGHT('0' + REPLACE(_apps.Version, '.', ''), 4)
ELSE NULL END AS Version
FROM CordonelProgress AS _progress
JOIN CordonelAppVersion AS _apps
ON _progress.Id = _apps.ProgressId
WHERE _progress.Id = @progressId
AND _apps.Version IS NOT NULL)
AS apps
LEFT JOIN(SELECT _history_.PcbId
, RIGHT(_history_.HistoryAppVersion, 2) + LEFT(_history_.HistoryAppVersion, 2) AS HistoryAppVersion
, RIGHT(_history_.HistoryAppCrc, 2) + LEFT(_history_.HistoryAppCrc, 2) AS HistoryAppCrc
FROM (SELECT _history.PcbId
, LEFT(REPLACE(_history.Version, '-', ''), 4) AS HistoryAppVersion
, LEFT(REPLACE(_history.Crc, '-', ''), 4) AS HistoryAppCrc
FROM (SELECT _left.PcbId
, _left.Value AS Version
, _right.Value AS Crc
, ROW_NUMBER() OVER (PARTITION BY _left.Value ORDER BY _right.Value, _right.date DESC) AS RN
FROM GenesisMeterRegisterHistory AS _left
JOIN GenesisMeterRegisterHistory AS _right
ON _left.PcbId = _right.PcbId
AND _left.ID + 1 = _right.ID
WHERE _left.PcbId = @pcbIdVarchar
AND _left.Address = '00-01'
AND _right.Address = '00-0D')
AS _history
WHERE _history.RN = 1)
AS _history_)
AS history
ON apps.Version = history.HistoryAppVersion
LEFT JOIN(SELECT _files.FlexnetAppId
, _files.Version AS FlexnetVersion
, _files.MetrologyVersion
, _files.CoreRevisionMin
, _files.CoreRevisionMax
, _files.AppId AS FilesAppId
, RIGHT(_files.AppVersion, 2) + LEFT(_files.AppVersion, 2) AS FilesAppVersion
, RIGHT(_files.FileCrc, 2) + LEFT(_files.FileCrc, 2) AS FilesAppCrc
, _files.ClusterFileId
, _files.FileName
, _files.FileContent
FROM (SELECT DISTINCT
cluster.FileId AS ClusterFileId
, fw.FlexnetAppId
, fw.Version
, fw.CoreRevisionMin
, fw.CoreRevisionMax
, fw.MetrologyVersion
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 81, 2) AS AppId
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 13, 4) AS AppVersion
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 9, 4) AS FileCrc
, __files.FileName
, CASE WHEN __files.FileName LIKE '%.txt'
THEN CONVERT(VARCHAR(MAX), __files.FileContent, 0)
ELSE CONVERT(VARCHAR(MAX), __files.FileContent, 2)
END AS FileContent
FROM Cordonel_CurrentFw AS fw
JOIN FileClusterStore AS cluster
ON cluster.FileId = fw.FileClusterStoreId
JOIN FileMapToCluster AS filemap
ON cluster.FileId = filemap.FileMapToCluster_FileClusterId
LEFT JOIN [File] AS __files
ON filemap.FileMapToCluster_FileId = __files.FileId
WHERE fw.Name = @fwVersion
AND fw.Metersize = @meterSize
AND fw.RadioFrequencyMhz = @frequency
AND fw.CurrentForProd = 1
AND fw.IsReleased = 1)
AS _files)
AS files
ON apps.AppId = files.FilesAppId
WHERE apps.Version IS NOT NULL
ORDER BY apps.AppId";
/// <summary>
/// Contains placeholder for the pcbId variable name at positon: 0
/// </summary>
private const string LATEST_APPS_VERSIONS_CRC_BY_PCB = @"
---------------------------------------------------------------------------------------------------
-- Declarations
---------------------------------------------------------------------------------------------------
DECLARE @pcbIdVarchar AS VARCHAR(20) = @{0};
DECLARE @progressId AS INT;
DECLARE @frequency AS INT;
DECLARE @meterSize AS INT;
---------------------------------------------------------------------------------------------------
-- Find and set latest progress id
---------------------------------------------------------------------------------------------------
SELECT @progressId = MAX(Id)
FROM CordonelProgress
WHERE PcbId = @pcbIdVarchar
---------------------------------------------------------------------------------------------------
-- Find and set meter size and frequency
---------------------------------------------------------------------------------------------------
SELECT @frequency = (SELECT TOP 1 CASE WHEN idn.Charcode = 'A'
THEN 868
WHEN idn.Charcode = 'B'
THEN 433
ELSE 0 END
FROM AlleIdentNrVakoMerkmale AS idn
WHERE idn.IdentNr = aap.IdentNr
AND idn.Stelle = 43
ORDER BY idn.Stelle)
, @meterSize = (SELECT TOP 1 cms.Dn_InternalId
FROM AlleIdentNrVakoMerkmale AS idn
JOIN CordonelMeterSizes AS cms
ON idn.Charcode = cms.Dn_VakoID
WHERE idn.IdentNr = aap.IdentNr
AND idn.Stelle = 4
ORDER BY idn.Stelle)
FROM MapPcbIdToSerialNumber AS map
JOIN AuftragPositionSerienNr AS aps
ON map.MapPcbIdToSerialNumber_SerialNumber = aps.SerienNr
JOIN AlleAuftragPositionen AS aap
ON aps.AuftragNr = aap.AuftragNr
AND aps.PositionNr = aap.PositionNr
WHERE map.MapPcbIdToSerialNumber_PcbId = @pcbIdVarchar
---------------------------------------------------------------------------------------------------
-- Select all apps with their versions and crc
---------------------------------------------------------------------------------------------------
SELECT DISTINCT
apps.PcbId AS AppsPcbId
, apps.AppId AS AppsAppId
, apps.Version AS AppsAppVersion
, history.PcbId AS HistoryPcbId
, history.HistoryAppVersion
, history.HistoryAppCrc
, files.FlexnetAppId
, files.FlexnetVersion
, files.MetrologyVersion
, files.CoreRevisionMin
, files.CoreRevisionMax
, files.FilesAppId
, files.FilesAppVersion
, files.FilesAppCrc
, files.ClusterFileId
, files.FileName
FROM (SELECT _progress.PcbId
, RIGHT(CONVERT(VARCHAR(10), CONVERT(BINARY(1), _apps.AppId, 2), 2), 2) AS AppId
, CASE WHEN LEN(_apps.Version) >= 4
THEN RIGHT('0' + REPLACE(_apps.Version, '.', ''), 4)
ELSE NULL END AS Version
FROM CordonelProgress AS _progress
JOIN CordonelAppVersion AS _apps
ON _progress.Id = _apps.ProgressId
WHERE _progress.Id = @progressId
AND _apps.Version IS NOT NULL)
AS apps
LEFT JOIN(SELECT _history_.PcbId
, RIGHT(_history_.HistoryAppVersion, 2) + LEFT(_history_.HistoryAppVersion, 2) AS HistoryAppVersion
, RIGHT(_history_.HistoryAppCrc, 2) + LEFT(_history_.HistoryAppCrc, 2) AS HistoryAppCrc
FROM (SELECT _history.PcbId
, LEFT(REPLACE(_history.Version, '-', ''), 4) AS HistoryAppVersion
, LEFT(REPLACE(_history.Crc, '-', ''), 4) AS HistoryAppCrc
FROM (SELECT _left.PcbId
, _left.Value AS Version
, _right.Value AS Crc
, ROW_NUMBER() OVER (PARTITION BY _left.Value ORDER BY _right.Value, _right.date DESC) AS RN
FROM GenesisMeterRegisterHistory AS _left
JOIN GenesisMeterRegisterHistory AS _right
ON _left.PcbId = _right.PcbId
AND _left.ID + 1 = _right.ID
WHERE _left.PcbId = @pcbIdVarchar
AND _left.Address = '00-01'
AND _right.Address = '00-0D')
AS _history
WHERE _history.RN = 1)
AS _history_)
AS history
ON apps.Version = history.HistoryAppVersion
LEFT JOIN(SELECT _files.FlexnetAppId
, _files.Version AS FlexnetVersion
, _files.MetrologyVersion
, _files.CoreRevisionMin
, _files.CoreRevisionMax
, _files.AppId AS FilesAppId
, RIGHT(_files.AppVersion, 2) + LEFT(_files.AppVersion, 2) AS FilesAppVersion
, RIGHT(_files.FileCrc, 2) + LEFT(_files.FileCrc, 2) AS FilesAppCrc
, _files.ClusterFileId
, _files.FileName
, _files.FileContent
FROM (SELECT DISTINCT
cluster.FileId AS ClusterFileId
, fw.FlexnetAppId
, fw.Version
, fw.CoreRevisionMin
, fw.CoreRevisionMax
, fw.MetrologyVersion
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 81, 2) AS AppId
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 13, 4) AS AppVersion
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 9, 4) AS FileCrc
, __files.FileName
, CASE WHEN __files.FileName LIKE '%.txt'
THEN CONVERT(VARCHAR(MAX), __files.FileContent, 0)
ELSE CONVERT(VARCHAR(MAX), __files.FileContent, 2)
END AS FileContent
FROM Cordonel_CurrentFw AS fw
JOIN FileClusterStore AS cluster
ON cluster.FileId = fw.FileClusterStoreId
JOIN FileMapToCluster AS filemap
ON cluster.FileId = filemap.FileMapToCluster_FileClusterId
LEFT JOIN [File] AS __files
ON filemap.FileMapToCluster_FileId = __files.FileId
WHERE fw.Name = @fwVersion)
AS _files)
AS files
ON apps.AppId = files.FilesAppId
WHERE apps.Version IS NOT NULL
ORDER BY apps.AppId";
/// <summary>
/// Contains placeholder for the pcbId variable name at positon: 0
/// </summary>
public const string LATEST_CALIBRATION_VALUES_BY_PCB = @"
SELECT TOP 1
ID
, PcbId
, CalFactor1
, CalFactor2
, CalFactor3
, ZeroOffset1
, ZeroOffset2
, ZeroOffset3
, FirstHitUpdatePeriod
, FirstHitShift
, FirstHitPercent1
, FirstHitPercent2
, FirstHitPercent3
, ToFTempOffset1
, ToFTempOffset2
, ToFTempOffset3
, MeterSize
, date
, successful
FROM CordonelMeterCalibrationResults
WHERE PcbId = @{0}
AND successful = 1
ORDER BY date DESC";
/// <summary>
/// Contains placeholder for the pcbId variable name at positon: 0
/// </summary>
public const string LATEST_REGISTER_WITH_VALUES_BY_PCB = @"
SELECT rh.Id
, rh.Address
, rh.Value
FROM (SELECT gmrh.Id AS Id
, gmrh.Address
, gmrh.Value
, ROW_NUMBER() OVER (PARTITION BY gmrh.Address ORDER BY gmrh.date DESC) AS Nr
FROM GenesisMeterRegisterHistory AS gmrh
WHERE gmrh.PcbId = @{0})
AS rh
WHERE rh.Nr = 1";
private const string PCB_PASSWORDS_HASHES = @"
SELECT SUBSTRING(CONVERT(VARCHAR(MAX)
, (SELECT '-' + ISNULL(x.Value, '')
FROM (SELECT TOP 3 hashes.Value
FROM (SELECT TOP 3
rh.date
, rh.Value
FROM GenesisMeterRegisterHistory AS rh
WHERE rh.PcbId = @{0}
AND rh.Address = '04-04'
AND LEN(rh.Value) > 15
ORDER BY rh.date DESC)
AS hashes
ORDER BY hashes.date)
AS x
FOR XML PATH(''), TYPE)
, 1)
, 2, 1000) AS Hashes
, (SELECT TOP 1 pwd.KitronSkeletonKey
FROM Genesis_PcbPassword AS pwd
WHERE pwd.PcbId = @{0}) AS Skeleton
, (SELECT TOP 1 pwd.Password
FROM Genesis_PcbPassword AS pwd
WHERE pwd.PcbId = @{0}) AS Password";
/// <summary>
/// Contains placeholder for the pcbId variable name at positon: 0
/// </summary>
private const string RSSI_SETUP_DEFAULTS_RESULTS_BY_PCB = @"
SELECT settings.RadioAddress
, settings.Frequency
, settings.Nennweite
, settings.Baulaenge
, settings.PulseModule
, settings.DruckSensor
, rssiLimits.id AS LimitId
, rssiLimits.RSSI_PAM_Min
, rssiLimits.RSSI_PAM_Max
, rssiLimits.RSSI_SEMI_Min
, rssiLimits.RSSI_SEMI_Max
, rssiHistory.id AS RadioId
, rssiHistory.LimitId AS RadioLimitId
, rssiHistory.RSSI_PAM
, rssiHistory.RSSI_SEMI
, rssiHistory.Datum
FROM (SELECT DISTINCT TOP 1
gm.Adresse % 10000000000 AS RadioAddress
, ISNULL(idn.Nennweite, CAST(cms.Dn_RealSize AS INT)) AS Nennweite
, ISNULL(idn.Baulaenge, CAST(_baulaengen.Wert AS INT)) AS Baulaenge
, CASE WHEN _druckSensors.Charcode = 'X' THEN 0 ELSE 1 END AS DruckSensor
, CASE WHEN _frequencies.Charcode = 'A' THEN 868 WHEN _frequencies.Charcode = 'B' THEN 433 ELSE NULL END AS Frequency
, CASE WHEN _pulseModules.Charcode = 'X' THEN 0 ELSE 1 END AS PulseModule
FROM MapPcbIdToSerialNumber AS map
JOIN AuftragPositionSerienNr AS aps
ON map.MapPcbIdToSerialNumber_SerialNumber = aps.SerienNr
LEFT JOIN Genesis_Meter AS gm
ON aps.SerienNr = gm.Seriennummer
JOIN AlleAuftragPositionen AS aap
ON aps.AuftragNr = aap.AuftragNr
AND aps.PositionNr = aap.PositionNr
JOIN Identnr AS idn
ON aap.IdentNr = idn.IdentNr
JOIN AlleIdentNrVakoMerkmale AS _nennweiten
ON aap.IdentNr = _nennweiten.IdentNr
AND _nennweiten.Stelle = 4
JOIN CordonelMeterSizes AS cms
ON _nennweiten.Charcode = cms.Dn_VakoID
JOIN AlleIdentNrVakoMerkmale AS _baulaengen
ON aap.IdentNr = _baulaengen.IdentNr
AND _baulaengen.Stelle = 14
JOIN AlleIdentNrVakoMerkmale AS _druckSensors
ON aap.IdentNr = _druckSensors.IdentNr
AND _druckSensors.Stelle = 22
JOIN AlleIdentNrVakoMerkmale AS _frequencies
ON aap.IdentNr = _frequencies.IdentNr
AND _frequencies.Stelle = 43
JOIN AlleIdentNrVakoMerkmale AS _pulseModules
ON aap.IdentNr = _pulseModules.IdentNr
AND _pulseModules.Stelle = 91
WHERE map.MapPcbIdToSerialNumber_PcbId = @{0})
AS settings
JOIN Cordonel_Radio_RSSI_History AS rssiHistory --> RadioLimitId
ON settings.RadioAddress = rssiHistory.RadioAdress
JOIN Cordonel_Radio_RSSI_Limits AS rssiLimits --> LimitId
ON rssiHistory.LimitId = rssiLimits.id
-- AND rssiLimits.Baulaenge = settings.Baulaenge
-- AND rssiLimits.Frequency = settings.Frequency
-- AND rssiLimits.Nennweite = settings.Nennweite
-- AND rssiLimits.Variant_o = settings.PulseModule
-- AND rssiLimits.Variant_p = settings.DruckSensor
ORDER BY rssiHistory.id DESC";
}
}
@@ -1,275 +0,0 @@
namespace LaaProduction.Data.Cordonel
{
using LaaPackages.Features.Cordonel.Models;
using LaaPackages.SqlClient;
using LaaProduction.Data.Cordonel.Interfaces;
using LaaProduction.Data.Cordonel.Repositories;
using System;
using System.Collections.Generic;
public partial class CordonelDbContext
{
private readonly Action<string> errorsCallback;
public CordonelDbContext(string connectionString, Action<string> errorsCallback = null)
{
this.errorsCallback = errorsCallback;
this.SqlConnection = new SqlConnection(connectionString, this.OnSqlErrors);
this.EOLProgress = new EOLProgressRepository(this);
this.ProductionOrders = new ProductionOrdersRepository(this);
this.Requirements = new RequirementsRepository(this);
this.SpecialRequirements = new SpecialRequirementsRepository(this);
this.StandardRequirements = new StandardRequirementsRepository(this);
}
public CordonelDbContext(SqlConnection sqlConnection, Action<string> errorsCallback = null)
{
this.SqlConnection = sqlConnection;
this.EOLProgress = new EOLProgressRepository(this);
this.ProductionOrders = new ProductionOrdersRepository(this);
this.Requirements = new RequirementsRepository(this);
this.SpecialRequirements = new SpecialRequirementsRepository(this);
this.StandardRequirements = new StandardRequirementsRepository(this);
}
internal SqlConnection SqlConnection { get; }
public IEOLProgressRepository<EOLProgressModel> EOLProgress { get; }
public IPORepository<CordonelProductionOrder> ProductionOrders { get; }
public IRequirementsRepository<CordonelRequirements> Requirements { get; set; }
public ISpecialRequirementsRepository<CordonelSpecialRequirement> SpecialRequirements { get; }
public IStandardRequirementRepository<CordonelStandardRequirement> StandardRequirements { get; }
public void OnSqlErrors(string error) => errorsCallback?.Invoke(error);
#region Virtual methods used from the Sentinel and Unit Testing
internal virtual IEnumerable<CordonelProductionData> GetProductionData(int pcbId)
{
var map = this.SqlConnection
.CreateCommand($@"
SELECT DISTINCT
cap.CordonelAssignedPicking_FertigungsAuftragsNr
, map.MapPcbIdToSerialNumber_SerialNumber
, map.MapPcbIdToSerialNumber_PcbId
FROM MapPcbIdToSerialNumber AS map
LEFT JOIN Cordonel_AssignedPicking AS cap
ON map.MapPcbIdToSerialNumber_PcbId = cap.CordonelAssignedPicking_PcbId
WHERE map.MapPcbIdToSerialNumber_PcbId = @{nameof(pcbId)}
AND map.MapPcbIdToSerialNumber_Deleted = 0
AND cap.CordonelAssignedPicking_IsDeleted = 0")
.SetParameter(nameof(pcbId), pcbId)
.ExecuteReader(x => new
{
FertigungsauftragNr = x.GetValue<int>(0),
SerienNr = x.GetValue<int>(1),
PcbId = x.GetValue<int>(2),
});
var productionDataList = new List<CordonelProductionData>();
foreach (var item in map)
{
var productionData = this.SqlConnection
.CreateCommand($@"
SELECT TOP 1
aps.AuftragNr
, aps.PositionNr
, aps.SerienNr
, aps.KundeneigeneSerienNr
, aps.StatusFertigung
, aps.Pruefgangnr
, aap.FertigungsauftragNr
, aap.IdentNr
, gm.Adresse % 10000000000
, reg.Charcode
, ms.Dn_Name
, ms.Dn_InternalId
, CASE WHEN fs.Charcode = 'X'
THEN 'None'
WHEN fs.Charcode = '1'
THEN 'Standard'
WHEN fs.Charcode = '2'
THEN 'Random'
WHEN fs.Charcode = '3'
THEN 'CSD'
END AS EncryptionKeyKind
FROM AuftragPositionSerienNr AS aps
LEFT JOIN AlleAuftragPositionen AS aap
ON aps.AuftragNr = aap.AuftragNr
AND aps.PositionNr = aap.PositionNr
LEFT JOIN Genesis_Meter AS gm
ON aps.SerienNr = gm.Seriennummer
LEFT JOIN AlleIdentNrVakoMerkmale AS reg
ON aap.IdentNr = reg.IdentNr
AND reg.Stelle = 4
AND reg.Laenge = 2
LEFT JOIN CordonelMeterSizes AS ms
ON reg.Charcode = ms.Dn_VakoID
LEFT JOIN AlleIdentNrVakoMerkmale AS fs
ON aap.IdentNr = fs.IdentNr
AND fs.Stelle = 46
AND fs.Laenge = 1
WHERE aps.SerienNr = @{nameof(item.SerienNr)}
ORDER BY aps.Pruefgangnr DESC")
.SetParameter(nameof(item.SerienNr), item.SerienNr)
.FirstOrDefault(x => new CordonelProductionData
{
PcbId = item.PcbId,
AuftragNr = x.GetValue<int>(0),
PositionNr = x.GetValue<int>(1),
SerienNr = x.GetValue<int>(2),
KundeneigeneSerienNr = x.GetValue<string>(3),
StatusFertigung = x.GetValue<StatusFertigung>(4),
PruefgangNr = x.GetValue<int>(5),
FertigungsauftragNr = x.GetValue<int>(6),
IdentNr = x.GetValue<int>(7),
Address = x.GetValue<ulong>(8),
RegionSizeKey = x.GetValue<string>(9),
MeterSizeName = x.GetValue<string>(10),
MeterSizeValue = x.GetValue<byte>(11),
EncryptionKeyKind = x.GetValue<CordonelEncryptionKeyKind>(12)
});
productionDataList.Add(productionData);
}
return productionDataList;
}
internal virtual EOLProgressModel GetEOLProgressModel(int pcbId)
=> this.EOLProgress.Read(pcbId);
internal virtual CordonelRequirements GetRequirements(int pcbId)
=> this.Requirements.FindByPcbIdFull(pcbId.ToString(), out _);
internal virtual IEnumerable<CordonelRegisterHistory> GetLatestRegistersWithValues(int pcbId)
=> this.SqlConnection
.CreateCommand(string.Format(LATEST_REGISTER_WITH_VALUES_BY_PCB, nameof(pcbId)))
.SetParameter(nameof(pcbId), pcbId.ToString())
.ExecuteReader(reader => new CordonelRegisterHistory
{
Id = reader.GetValue<long>(0),
Address = reader.GetValue<string>(1),
ValueHex = reader.GetValue<string>(2),
});
internal virtual IEnumerable<CordonelAppVeriosnCrc> GetAppsWithVersions(int pcbId, string version)
=> this.SqlConnection
.CreateCommand(string.Format(APPS_VERSIONS_CRC_BY_PCB_V, nameof(pcbId), nameof(version)))
.SetParameter(nameof(pcbId), pcbId)
.SetParameter(nameof(version), version)
.ExecuteReader(reader => new CordonelAppVeriosnCrc
{
AppsPcbId = reader.GetValue<int>(0),
AppsAppId = reader.GetValue<string>(1),
AppsAppVersion = reader.GetValue<string>(2),
HistoryPcbId = reader.GetValue<int>(3),
HistoryAppVersion = reader.GetValue<string>(4),
HistoryAppCrc = reader.GetValue<string>(5),
FlexnetAppId = reader.GetValue<string>(6),
FlexnetVersion = reader.GetValue<string>(7),
MetrologyVersion = reader.GetValue<int>(8),
CoreRevisionMin = reader.GetValue<int>(9),
CoreRevisionMax = reader.GetValue<int>(10),
FilesAppId = reader.GetValue<string>(11),
FilesAppVersion = reader.GetValue<string>(12),
FilesAppCrc = reader.GetValue<string>(13),
ClusterFileId = reader.GetValue<int>(14),
FileName = reader.GetValue<string>(15),
});
internal virtual IEnumerable<CordonelAppVeriosnCrc> GetLatestAppsWithVersions(int pcbId, string fwVersion, bool isSpecial)
=> this.SqlConnection
.CreateCommand(string.Format(LATEST_APPS_VERSIONS_CRC_BY_PCB, nameof(pcbId), nameof(fwVersion)))
.SetParameter(nameof(pcbId), pcbId)
.SetParameter(nameof(fwVersion), fwVersion)
.ExecuteReader(reader => new CordonelAppVeriosnCrc
{
AppsPcbId = reader.GetValue<int>(0),
AppsAppId = reader.GetValue<string>(1),
AppsAppVersion = reader.GetValue<string>(2),
HistoryPcbId = reader.GetValue<int>(3),
HistoryAppVersion = reader.GetValue<string>(4),
HistoryAppCrc = reader.GetValue<string>(5),
FlexnetAppId = reader.GetValue<string>(6),
FlexnetVersion = reader.GetValue<string>(7),
MetrologyVersion = reader.GetValue<int>(8),
CoreRevisionMin = reader.GetValue<int>(9),
CoreRevisionMax = reader.GetValue<int>(10),
FilesAppId = reader.GetValue<string>(11),
FilesAppVersion = reader.GetValue<string>(12),
FilesAppCrc = reader.GetValue<string>(13),
ClusterFileId = reader.GetValue<int>(14),
FileName = reader.GetValue<string>(15),
});
internal virtual CordonelMetrologyValues GetLatestGenesisFlowValues(object pcbId)
=> this.SqlConnection
.CreateCommand(string.Format(LATEST_CALIBRATION_VALUES_BY_PCB, nameof(pcbId)))
.SetParameter(nameof(pcbId), pcbId?.ToString())
.FirstOrDefault(reader => new CordonelMetrologyValues
{
Id = reader.GetValue<int>(0),
PcbId = reader.GetValue<int>(1),
CalFactor1 = reader.GetValue<int>(2),
CalFactor2 = reader.GetValue<int>(3),
CalFactor3 = reader.GetValue<int>(4),
ZeroOffset1 = reader.GetValue<int>(5),
ZeroOffset2 = reader.GetValue<int>(6),
ZeroOffset3 = reader.GetValue<int>(7),
FirstHitUpdatePeriod = reader.GetValue<int>(8),
FirstHitShift = reader.GetValue<int>(9),
FirstHitPercent1 = reader.GetValue<int>(10),
FirstHitPercent2 = reader.GetValue<int>(11),
FirstHitPercent3 = reader.GetValue<int>(12),
ToFTempOffset1 = reader.GetValue<int>(13),
ToFTempOffset2 = reader.GetValue<int>(14),
ToFTempOffset3 = reader.GetValue<int>(15),
MeterSize = reader.GetValue<int>(16),
Date = reader.GetValue<DateTime>(17),
Succeeded = reader.GetValue<bool>(18),
});
internal virtual CordonelRSSIValues GetLatestRssiValues(string pcbId)
=> this.SqlConnection
.CreateCommand(string.Format(RSSI_SETUP_DEFAULTS_RESULTS_BY_PCB, nameof(pcbId)))
.SetParameter(nameof(pcbId), pcbId)
.FirstOrDefault(reader => new CordonelRSSIValues
{
RadioAddress = reader.GetValue<int?>(0),
Frequency = reader.GetValue<int?>(1),
Nennweite = reader.GetValue<int?>(2),
Baulaenge = reader.GetValue<int?>(3),
PulseModule = reader.GetValue<bool?>(4),
DruckSensor = reader.GetValue<bool?>(5),
LimitId = reader.GetValue<int?>(6),
RSSI_PAM_Min = reader.GetValue<int?>(7),
RSSI_PAM_Max = reader.GetValue<int?>(8),
RSSI_SEMI_Min = reader.GetValue<int?>(9),
RSSI_SEMI_Max = reader.GetValue<int?>(10),
RadioCheckId = reader.GetValue<int?>(11),
RadioLimitId = reader.GetValue<int?>(12),
RSSI_PAM = reader.GetValue<int?>(13),
RSSI_SEMI = reader.GetValue<int?>(14),
Datum = reader.GetValue<DateTime?>(15),
});
internal CordonelPcbPasswordsHashes GetPasswordsHashes(int pcbId)
=> this.SqlConnection
.CreateCommand(string.Format(PCB_PASSWORDS_HASHES, nameof(pcbId)))
.SetParameter(nameof(pcbId), pcbId.ToString())
.FirstOrDefault(x => new CordonelPcbPasswordsHashes
{
Hashes = x.GetValue<string>(0),
Skeleton = x.GetValue<string>(1),
Password = x.GetValue<string>(2),
});
#endregion Virtual methods used from the Sentinel and Unit Testing
}
}
@@ -1,6 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
public interface IEOLProgressRepository<T> : IRepositoryCreate<T>, IRepositoryRead<T>, IRepositoryUpdate<T>, IRepositoryDelete<T>
{
}
}
@@ -1,10 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
using System;
using System.Collections.Generic;
public interface IFilterRepository<T> : IRepositoryEnumerable<T>
{
IEnumerable<T> Like(string pattern);
}
}
@@ -1,13 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
using LaaPackages.Features.Cordonel.Models;
using System.Collections.Generic;
public interface IPORepository<T> : IFilterRepository<T>
{
IEnumerable<string> GetPcbs(string ponr);
IEnumerable<RadioKeyEntry> HasRightRadioKey(ulong address);
}
}
@@ -1,7 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
public interface IRepositoryCreate<T>
{
T Create(T model);
}
}
@@ -1,7 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
public interface IRepositoryDelete<T>
{
T Delete(T model);
}
}
@@ -1,8 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
using System.Collections.Generic;
public interface IRepositoryEnumerable<T> : IEnumerable<T>
{
}
}
@@ -1,7 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
public interface IRepositoryRead<T>
{
T Read(T model);
}
}
@@ -1,7 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
public interface IRepositoryUpdate<T>
{
T Update(T model);
}
}
@@ -1,15 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
public interface IRepository<T> : IRepositoryEnumerable<T>
{
T Add(T model);
T Delete(object id);
T FirstOrDefault(object id);
T FirstOrDefault(params object[] ids);
T Update(T model);
}
}
@@ -1,13 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
using System;
public interface IRequirementsRepository<T>
{
T FindByPcbId(string pcbid);
T FindByPcbIdFull(string pcbid, out string error);
T FindByPoNo(string pono);
}
}
@@ -1,23 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
using LaaPackages.Features.Cordonel.Models;
using System.Collections.Generic;
public interface ISpecialRequirementsRepository<T> : IRepository<T>
{
void Approve(int id, string name, string comment);
SpecialRequiremetnsFilter Filter();
IEnumerable<T> Filter(SpecialRequiremetnsFilter filter);
T Find(CordonelSpecialRequirement model);
T FirstOrDefaultByPO(string ponr);
T FindFirstOrDefault(int standardId, int pono, int? pcbId);
void Unapprove(int id);
}
}
@@ -1,21 +0,0 @@
namespace LaaProduction.Data.Cordonel.Interfaces
{
using LaaPackages.Features.Cordonel.Models;
using System.Collections.Generic;
public interface IStandardRequirementRepository<T> : IRepository<T>
{
void Approve(int id, string name, string comment);
StandardRequiremetnsFilter Filter();
IEnumerable<T> Filter(StandardRequiremetnsFilter filter);
T FirstOrDefaultByKey(string key);
T FirstOrDefaultByPO(string ponr);
void Unapprove(int id);
}
}
@@ -1,96 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{03784923-1FD3-4535-80F5-286728DF62AB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaaProduction.Data.Cordonel</RootNamespace>
<AssemblyName>LaaProduction.Data.Cordonel</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>IDE0003;IDE0049;</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CordonelDbContext.cs" />
<Compile Include="CordonelDbContext.Queries.cs" />
<Compile Include="Interfaces\IEOLProgressRepository[T].cs" />
<Compile Include="Interfaces\IFilterRepository[T].cs" />
<Compile Include="Interfaces\IPORepository[T].cs" />
<Compile Include="Interfaces\IRepositoryCreate[T].cs" />
<Compile Include="Interfaces\IRepositoryDelete[T].cs" />
<Compile Include="Interfaces\IRepositoryEnumerable[T].cs" />
<Compile Include="Interfaces\IRepositoryRead[T].cs" />
<Compile Include="Interfaces\IRepositoryUpdate[T].cs" />
<Compile Include="Interfaces\IRequirementsRepository[T].cs" />
<Compile Include="Interfaces\ISpecialRequirementsRepository[T].cs" />
<Compile Include="Interfaces\IStandardRequirementRepository[T].cs" />
<Compile Include="Interfaces\IRepository[T].cs" />
<Compile Include="Sentinel\LocalhostHttpClient.cs" />
<Compile Include="Sentinel\Sentinel.cs" />
<Compile Include="Sentinel\SentinelHttpClient.cs" />
<Compile Include="Sentinel\SentinelException.cs" />
<Compile Include="Sentinel\SentinelResult.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repositories\EOLProgressRepository.cs" />
<Compile Include="Repositories\ProductionOrdersRepository.cs" />
<Compile Include="Repositories\RequirementsRepository.cs" />
<Compile Include="Repositories\SpecialRequirementsRepository.cs" />
<Compile Include="Repositories\StandardRequirementsRepository.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\LaaPackages\LaaPackages.Features.Cordonel\LaaPackages.Features.Cordonel.csproj">
<Project>{8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}</Project>
<Name>LaaPackages.Features.Cordonel</Name>
</ProjectReference>
<ProjectReference Include="..\..\LaaPackages\LaaPackages.HttpClient\LaaPackages.HttpClient.csproj">
<Project>{C9816412-7752-4F7A-8BD2-765DB6D58B3C}</Project>
<Name>LaaPackages.HttpClient</Name>
</ProjectReference>
<ProjectReference Include="..\..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
<Name>LaaPackages.SqlClient</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,37 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LaaProduction.Data.Cordonel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LaaProduction.Data.Cordonel")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("03784923-1fd3-4535-80f5-286728df62ab")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("LaaProduction.Data.Cordonel.UnitTests")]
@@ -1,204 +0,0 @@
namespace LaaProduction.Data.Cordonel.Repositories
{
using LaaPackages.Features.Cordonel.Models;
using LaaPackages.SqlClient;
using LaaProduction.Data.Cordonel.Interfaces;
using System;
public class EOLProgressRepository : IEOLProgressRepository<EOLProgressModel>
{
private readonly CordonelDbContext dbContext;
private readonly SqlConnection sqlConnection;
public EOLProgressRepository(CordonelDbContext dbContext)
{
this.dbContext = dbContext;
this.sqlConnection = dbContext.SqlConnection;
}
public EOLProgressModel Create(EOLProgressModel model)
{
this.sqlConnection
.CreateCommand($@"INSERT INTO Cordonel_EOL_Progress (PcbId) VALUES (@{nameof(model.PcbId)})")
.SetParameter(nameof(model.PcbId), model.PcbId)
.ExecuteNonQuery();
return this.Read(model);
}
public EOLProgressModel Read(EOLProgressModel model)
{
var pcbId = model.PcbId;
return this.sqlConnection
.CreateCommand($@"
SELECT Id
, PcbId
, StartDate
, StandardRequirementId
, StandardRequirementVersion
, SpecialRequirementId
, SpecialRequirementVersion
, RequirementRequestChecked
, RequirementPcbIdChecked
, RequirementOrderChecked
, RequirementRegionChecked
, ProductionStatusLutCrc
, ProductionStatusFwVersion
, ProductionStatusMeterSize
, ProductionStatusDrainedBatteryLoad
, ProductionStatusBatteryLoadChecked
, ProductionStatusRemainingLifeTime
, ProductionStatusRemainingLifeTimeChecked
, MaxStorageMonths
, MaxStorageMonthsChecked
, ProductionStatusZeroFlowChecked
, ProductionStatusCalibrationChecked
, ParametrizationDoneChecked
, StoreConfigurationDoneChecked
, RebootDoneChecked
, ParametrizationCompareChecked
, RadioCheckId
, FinalRadioSystemState
, FinalRadioSystemStateCheck
, PasswordFileInstalledCheck
, AttachmentsChecked
, EOLCompleteDate
, EOLSoftwareNameAndVersion
, SAPExportDone
, SentinelCompleted
, SentinelCompletedDate
FROM Cordonel_EOL_Progress
WHERE PcbId = @{nameof(pcbId)}")
.SetParameter(nameof(pcbId), pcbId)
.FirstOrDefault(reader => new EOLProgressModel
{
Id = reader.GetValue<int>(0),
PcbId = reader.GetValue<int>(1),
StartDate = reader.GetValue<DateTime>(2),
StandardRequirementId = reader.GetValue<int?>(3),
StandardRequirementVersion = reader.GetValue<int?>(4),
SpecialRequirementId = reader.GetValue<int?>(5),
SpecialRequirementVersion = reader.GetValue<int?>(6),
RequirementRequestChecked = reader.GetValue<string>(7),
RequirementPcbIdChecked = reader.GetValue<string>(8),
RequirementOrderChecked = reader.GetValue<string>(9),
RequirementRegionChecked = reader.GetValue<string>(10),
ProductionStatusLutCrc = reader.GetValue<string>(11),
ProductionStatusFwVersion = reader.GetValue<string>(12),
ProductionStatusMeterSize = reader.GetValue<string>(13),
ProductionStatusDrainedBatteryLoad = reader.GetValue<Double?>(14),
ProductionStatusBatteryLoadChecked = reader.GetValue<string>(15),
ProductionStatusRemainingLifeTime = reader.GetValue<Double?>(16),
ProductionStatusRemainingLifeTimeChecked = reader.GetValue<string>(17),
MaxStorageMonths = reader.GetValue<Double?>(18),
MaxStorageMonthsChecked = reader.GetValue<string>(19),
ProductionStatusZeroFlowChecked = reader.GetValue<string>(20),
ProductionStatusCalibrationChecked = reader.GetValue<string>(21),
ParametrizationDoneChecked = reader.GetValue<string>(22),
StoreConfigurationDoneChecked = reader.GetValue<string>(23),
RebootDoneChecked = reader.GetValue<string>(24),
ParametrizationCompareChecked = reader.GetValue<string>(25),
RadioCheckId = reader.GetValue<long?>(26),
FinalRadioSystemState = reader.GetValue<long?>(27),
FinalRadioSystemStateCheck = reader.GetValue<string>(28),
PasswordFileInstalledCheck = reader.GetValue<string>(29),
AttachmentsChecked = reader.GetValue<string>(30),
EOLCompleteDate = reader.GetValue<DateTime?>(31),
EOLSoftwareNameAndVersion = reader.GetValue<string>(32),
SAPExportDone = reader.GetValue<string>(33),
SentinelCompleted = reader.GetValue<string>(34),
SentinelCompletedDate = reader.GetValue<DateTime?>(35),
});
}
public EOLProgressModel Update(EOLProgressModel model)
{
var result = this.sqlConnection
.CreateCommand($@"
UPDATE Cordonel_EOL_Progress
SET StandardRequirementId = @{nameof(model.StandardRequirementId)}
, StandardRequirementVersion = @{nameof(model.StandardRequirementVersion)}
, SpecialRequirementId = @{nameof(model.SpecialRequirementId)}
, SpecialRequirementVersion = @{nameof(model.SpecialRequirementVersion)}
, RequirementRequestChecked = @{nameof(model.RequirementRequestChecked)}
, RequirementPcbIdChecked = @{nameof(model.RequirementPcbIdChecked)}
, RequirementOrderChecked = @{nameof(model.RequirementOrderChecked)}
, RequirementRegionChecked = @{nameof(model.RequirementRegionChecked)}
, ProductionStatusLutCrc = @{nameof(model.ProductionStatusLutCrc)}
, ProductionStatusFwVersion = @{nameof(model.ProductionStatusFwVersion)}
, ProductionStatusMeterSize = @{nameof(model.ProductionStatusMeterSize)}
, ProductionStatusDrainedBatteryLoad = @{nameof(model.ProductionStatusDrainedBatteryLoad)}
, ProductionStatusBatteryLoadChecked = @{nameof(model.ProductionStatusBatteryLoadChecked)}
, ProductionStatusRemainingLifeTime = @{nameof(model.ProductionStatusRemainingLifeTime)}
, ProductionStatusRemainingLifeTimeChecked = @{nameof(model.ProductionStatusRemainingLifeTimeChecked)}
, MaxStorageMonths = @{nameof(model.MaxStorageMonths)}
, MaxStorageMonthsChecked = @{nameof(model.MaxStorageMonthsChecked)}
, ProductionStatusZeroFlowChecked = @{nameof(model.ProductionStatusZeroFlowChecked)}
, ProductionStatusCalibrationChecked = @{nameof(model.ProductionStatusCalibrationChecked)}
, ParametrizationDoneChecked = @{nameof(model.ParametrizationDoneChecked)}
, StoreConfigurationDoneChecked = @{nameof(model.StoreConfigurationDoneChecked)}
, RebootDoneChecked = @{nameof(model.RebootDoneChecked)}
, ParametrizationCompareChecked = @{nameof(model.ParametrizationCompareChecked)}
, RadioCheckId = @{nameof(model.RadioCheckId)}
, FinalRadioSystemState = @{nameof(model.FinalRadioSystemState)}
, FinalRadioSystemStateCheck = @{nameof(model.FinalRadioSystemStateCheck)}
, PasswordFileInstalledCheck = @{nameof(model.PasswordFileInstalledCheck)}
, AttachmentsChecked = @{nameof(model.AttachmentsChecked)}
, EOLCompleteDate = @{nameof(model.EOLCompleteDate)}
, EOLSoftwareNameAndVersion = @{nameof(model.EOLSoftwareNameAndVersion)}
WHERE PcbId = @{nameof(model.PcbId)}
AND EOLCompleteDate IS NULL")
.SetParameter(nameof(model.PcbId), model.PcbId)
.SetParameter(nameof(model.StandardRequirementId), model.StandardRequirementId)
.SetParameter(nameof(model.StandardRequirementVersion), model.StandardRequirementVersion)
.SetParameter(nameof(model.SpecialRequirementId), model.SpecialRequirementId)
.SetParameter(nameof(model.SpecialRequirementVersion), model.SpecialRequirementVersion)
.SetParameter(nameof(model.RequirementRequestChecked), model.RequirementRequestChecked?.ToString())
.SetParameter(nameof(model.RequirementPcbIdChecked), model.RequirementPcbIdChecked?.ToString())
.SetParameter(nameof(model.RequirementOrderChecked), model.RequirementOrderChecked?.ToString())
.SetParameter(nameof(model.RequirementRegionChecked), model.RequirementRegionChecked?.ToString())
.SetParameter(nameof(model.ProductionStatusLutCrc), model.ProductionStatusLutCrc)
.SetParameter(nameof(model.ProductionStatusFwVersion), model.ProductionStatusFwVersion)
.SetParameter(nameof(model.ProductionStatusMeterSize), model.ProductionStatusMeterSize)
.SetParameter(nameof(model.ProductionStatusDrainedBatteryLoad), model.ProductionStatusDrainedBatteryLoad)
.SetParameter(nameof(model.ProductionStatusBatteryLoadChecked), model.ProductionStatusBatteryLoadChecked?.ToString())
.SetParameter(nameof(model.ProductionStatusRemainingLifeTime), model.ProductionStatusRemainingLifeTime)
.SetParameter(nameof(model.ProductionStatusRemainingLifeTimeChecked), model.ProductionStatusRemainingLifeTimeChecked?.ToString())
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
.SetParameter(nameof(model.MaxStorageMonthsChecked), model.MaxStorageMonthsChecked?.ToString())
.SetParameter(nameof(model.ProductionStatusZeroFlowChecked), model.ProductionStatusZeroFlowChecked?.ToString())
.SetParameter(nameof(model.ProductionStatusCalibrationChecked), model.ProductionStatusCalibrationChecked?.ToString())
.SetParameter(nameof(model.ParametrizationDoneChecked), model.ParametrizationDoneChecked?.ToString())
.SetParameter(nameof(model.StoreConfigurationDoneChecked), model.StoreConfigurationDoneChecked?.ToString())
.SetParameter(nameof(model.RebootDoneChecked), model.RebootDoneChecked?.ToString())
.SetParameter(nameof(model.ParametrizationCompareChecked), model.ParametrizationCompareChecked?.ToString())
.SetParameter(nameof(model.RadioCheckId), model.RadioCheckId)
.SetParameter(nameof(model.FinalRadioSystemState), model.FinalRadioSystemState)
.SetParameter(nameof(model.FinalRadioSystemStateCheck), model.FinalRadioSystemStateCheck?.ToString())
.SetParameter(nameof(model.PasswordFileInstalledCheck), model.PasswordFileInstalledCheck?.ToString())
.SetParameter(nameof(model.AttachmentsChecked), model.AttachmentsChecked?.ToString())
.SetParameter(nameof(model.EOLCompleteDate), model.EOLCompleteDate)
.SetParameter(nameof(model.EOLSoftwareNameAndVersion), model.EOLSoftwareNameAndVersion)
.ExecuteNonQuery();
return this.Read(model);
}
public EOLProgressModel Delete(EOLProgressModel model)
{
var deleted = this.Read(model);
if (deleted != null)
{
this.sqlConnection
.CreateCommand($@"DELETE FROM Cordonel_EOL_Progress WHERE PcbId = @{nameof(model.PcbId)}")
.SetParameter(nameof(model.PcbId), model.PcbId)
.ExecuteNonQuery();
}
return deleted;
}
}
}
@@ -1,161 +0,0 @@
namespace LaaProduction.Data.Cordonel.Repositories
{
using LaaPackages.Features.Cordonel.Models;
using LaaPackages.SqlClient;
using LaaProduction.Data.Cordonel.Interfaces;
using System;
using System.Collections;
using System.Collections.Generic;
public class ProductionOrdersRepository : IPORepository<CordonelProductionOrder>
{
private readonly CordonelDbContext dbContext;
private readonly SqlConnection sqlConnection;
public ProductionOrdersRepository(CordonelDbContext dbContext)
{
this.dbContext = dbContext;
this.sqlConnection = dbContext.SqlConnection;
}
public IEnumerator<CordonelProductionOrder> GetEnumerator()
=> this.sqlConnection
.CreateCommand(@"
SELECT DISTINCT
[VMM].[Charcode] AS [Key]
, [REG].[Wert] AS [Region]
, [CMS].[Dn_Name] AS [Size]
, [IDN].[IdentNr] AS [IdentNr]
, [AAP].[AuftragNr] AS [AuftragNr]
, [AAP].[PositionNr] AS [PositionNr]
, [AAP].[FertigungsauftragNr] AS [FertigungsauftragNr]
FROM [VAKO_Merkmale] AS [VMM]
LEFT JOIN (SELECT [Charcode]
, [Wert]
FROM [VAKO_Merkmale]
WHERE [Basis] = 'GNS'
AND [Stelle] = 5)
AS [REG]
ON [VMM].[Charcode] LIKE '_' + [REG].[Charcode]
LEFT JOIN [Identnr] AS [IDN]
ON [VMM].[Charcode] = SUBSTRING([IDN].[VakoCode], [VMM].[Stelle], [VMM].[Laenge])
LEFT JOIN [CordonelMeterSizes] AS [CMS]
ON [CMS].[Dn_VakoID] = [VMM].[Charcode]
JOIN [AlleAuftragPositionen] AS [AAP]
ON [AAP].[IdentNr] = [IDN].[IdentNr]
WHERE [VMM].[Basis] = 'GNS'
AND [VMM].[Bezeichnung] = 'NW')
ORDER BY [AAP].[IdentNr] DESC
, [AAP].[FertigungsauftragNr] DESC
, [AAP].[AuftragNr] DESC")
.ExecuteReader(x => new CordonelProductionOrder
{
Key = x.GetValue<string>(0),
Region = x.GetValue<string>(1),
Size = x.GetValue<string>(2),
IdentNr = x.GetValue<string>(3),
AuftragNr = x.GetValue<string>(4),
PositionNr = x.GetValue<string>(5),
FertigungsauftragNr = x.GetValue<string>(6),
})
.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> this.GetEnumerator();
public IEnumerable<string> GetPcbs(string ponr)
=> this.sqlConnection
.CreateCommand($@"
SELECT cap.CordonelAssignedPicking_PcbId
FROM Cordonel_AssignedPicking AS cap
LEFT JOIN Cordonel_Special_Requirements AS spl
ON cap.CordonelAssignedPicking_FertigungsAuftragsNr = spl.ProductionOrderNo
AND cap.CordonelAssignedPicking_PcbId = spl.PcbId
WHERE cap.CordonelAssignedPicking_FertigungsAuftragsNr = @{nameof(ponr)}
AND spl.PcbId IS NULL")
.SetParameter(nameof(ponr), ponr)
.ExecuteReader(x => x.GetValue<string>(0));
public IEnumerable<CordonelProductionOrder> Like(string pattern)
=> this.sqlConnection
.CreateCommand($@"
SELECT DISTINCT
[VMM].[Charcode] AS [Key]
, [REG].[Wert] AS [Region]
, [CMS].[Dn_Name] AS [Size]
, [AAP].[IdentNr] AS [IdentNr]
, [AAP].[AuftragNr] AS [AuftragNr]
, [AAP].[PositionNr] AS [PositionNr]
, [AAP].[FertigungsauftragNr] AS [FertigungsauftragNr]
FROM [VAKO_Merkmale] AS [VMM]
LEFT JOIN (SELECT [Charcode]
, [Wert]
FROM [VAKO_Merkmale]
WHERE [Basis] = 'GNS'
AND [Stelle] = 5)
AS [REG]
ON [VMM].[Charcode] LIKE '_' + [REG].[Charcode]
LEFT JOIN [Identnr] AS [IDN]
ON [VMM].[Charcode] = SUBSTRING([IDN].[VakoCode], [VMM].[Stelle], [VMM].[Laenge])
LEFT JOIN [CordonelMeterSizes] AS [CMS]
ON [CMS].[Dn_VakoID] = [VMM].[Charcode]
JOIN [AlleAuftragPositionen] AS [AAP]
ON [AAP].[IdentNr] = [IDN].[IdentNr]
WHERE [VMM].[Basis] = 'GNS'
AND [VMM].[Bezeichnung] = 'NW'
AND ([AAP].[FertigungsauftragNr] LIKE @{nameof(pattern)}
OR [AAP].[AuftragNr] LIKE @{nameof(pattern)}
OR [AAP].[IdentNr] LIKE @{nameof(pattern)})
ORDER BY [AAP].[IdentNr] DESC
, [AAP].[FertigungsauftragNr] DESC
, [AAP].[AuftragNr] DESC")
.SetParameter(nameof(pattern), $"%{pattern}%")
.ExecuteReader(x => new CordonelProductionOrder
{
Key = x.GetValue<string>(0),
Region = x.GetValue<string>(1),
Size = x.GetValue<string>(2),
IdentNr = x.GetValue<string>(3),
AuftragNr = x.GetValue<string>(4),
PositionNr = x.GetValue<string>(5),
FertigungsauftragNr = x.GetValue<string>(6),
});
public IEnumerable<RadioKeyEntry> HasRightRadioKey(ulong address)
=> this.sqlConnection
.CreateCommand($@"
SELECT DISTINCT
apg.AuftragNr
, apg.PositionNr
, gm.Seriennummer
, gm.FunkschluesselIndex
, vmm.Wert
, apg.IstDatum
FROM Genesis_Meter AS gm
JOIN AuftragPositionSerienNr AS aps
ON gm.Seriennummer = aps.SerienNr
JOIN AuftragPosition_Gesamt AS apg
ON aps.AuftragNr = apg.AuftragNr
AND aps.PositionNr = apg.PositionNr
JOIN Identnr AS idn
ON apg.IdentNr = idn.IdentNr
JOIN VAKO_Merkmale AS vmm
ON vmm.Basis = 'GNS'
AND vmm.Stelle = 46
AND vmm.Charcode = SUBSTRING(idn.VakoCode, vmm.Stelle, 1)
WHERE gm.Adresse = @{nameof(address)}
AND ((gm.FunkschluesselIndex IS NULL AND vmm.Charcode = '2')
OR (gm.FunkschluesselIndex IS NOT NULL AND vmm.Charcode = '1'))")
.SetParameter(nameof(address), $"10{address}")
.ExecuteReader(x => new RadioKeyEntry
{
Auftrag = x.GetValue<int>(0),
Position = x.GetValue<int>(1),
SerienNr = x.GetValue<int>(2),
KeyIndex = x.GetValue<string>(3),
KeyType = x.GetValue<string>(4),
IsDate = x.GetValue<DateTime>(5)
});
}
}
@@ -1,301 +0,0 @@
namespace LaaProduction.Data.Cordonel.Repositories
{
using LaaPackages.Features.Cordonel.Models;
using LaaPackages.SqlClient;
using LaaProduction.Data.Cordonel.Interfaces;
using System;
public class RequirementsRepository : IRequirementsRepository<CordonelRequirements>
{
private readonly CordonelDbContext dbContext;
private readonly SqlConnection sqlConnection;
public RequirementsRepository(CordonelDbContext dbContext)
{
this.dbContext = dbContext;
this.sqlConnection = dbContext.SqlConnection;
}
public CordonelRequirements FindByPcbId(string pcbid)
=> this.sqlConnection
.CreateCommand($@"
SELECT DISTINCT
cr.SpecialId
, cr.SpecialVersion
, cr.StandardId
, cr.StandardVersion
, cr.Region
, cr.Size
, cr.PoNr
, aap.FertigungsauftragNr
, cr.PcbId
, map.MapPcbIdToSerialNumber_PcbId
, cr.SkipCalibration
, cr.SkipRadioCheck
, cr.FwVersion
, cr.LutCrc
, cr.RLTYA
, cr.RLTYS
, cr.MDBLPA
, cr.MDBLPS
, CASE WHEN aap.Menge < 6
THEN MSM
ELSE MSMBO
END AS MaxStorageMonths
, cr.QuiescentCurrent_uA
, cr.EPBLP
, cr.Timestamp
, cr.CreatedBy
, cr.Comment
, cr.IsSplActive
, cr.IsStdActive
, cr.IsSplApproved
, cr.IsStdApproved
, cr.RegionSizeKey
FROM Cordonel_Requirements AS cr
JOIN AlleAuftragPositionen AS aap
ON cr.IdentNr = aap.IdentNr
JOIN AuftragPositionSerienNr AS aps
ON aap.AuftragNr = aps.AuftragNr
AND aap.PositionNr = aps.PositionNr
JOIN MapPcbIdToSerialNumber AS map
ON aps.SerienNr = map.MapPcbIdToSerialNumber_SerialNumber
WHERE map.MapPcbIdToSerialNumber_PcbId = @{nameof(pcbid)}
AND (cr.PoNr = aap.FertigungsauftragNr OR cr.PoNr IS NULL)
AND (cr.PcbId = map.MapPcbIdToSerialNumber_PcbId OR cr.PcbId IS NULL)
ORDER BY cr.StandardId DESC
, cr.SpecialId DESC")
.SetParameter(nameof(pcbid), pcbid)
.FirstOrDefault(this.ParseCordonelRequirements);
public CordonelRequirements FindByPcbIdFull(string pcbid, out string error)
{
error = default(string);
var requirements = default(CordonelRequirements);
var pono = default(int?);
var pcb = default(int?);
this.sqlConnection
.CreateCommand($@"
SELECT DISTINCT
cap.CordonelAssignedPicking_FertigungsAuftragsNr
, map.MapPcbIdToSerialNumber_PcbId
FROM Cordonel_AssignedPicking AS cap
JOIN MapPcbIdToSerialNumber AS map
ON cap.CordonelAssignedPicking_PcbId = map.MapPcbIdToSerialNumber_PcbId
WHERE cap.CordonelAssignedPicking_PcbId = @{nameof(pcbid)}")
.SetParameter(nameof(pcbid), pcbid)
.FirstOrDefault(x =>
{
pono = x.GetValue<int?>(0);
pcb = x.GetValue<int?>(1);
});
if (pono is null)
{
error = $"Fertigungsauftragnr nicht gefunden für pcbId: {pcbid}";
}
else if (pcb is null)
{
error = $"PcbId: {pcbid} nicht gefunden";
}
var identnr = default(int?);
var menge = default(int?);
var key = default(string);
this.sqlConnection
.CreateCommand($@"
SELECT aap.IdentNr
, aap.Menge
, SUBSTRING(idn.VakoCode, 4, 1) + (CASE WHEN SUBSTRING(idn.VakoCode, 5, 1) = 'U' THEN 'U' ELSE 'E' END)
FROM AlleAuftragPositionen AS aap
JOIN Identnr AS idn
ON aap.IdentNr = idn.IdentNr
WHERE aap.FertigungsauftragNr = @{nameof(pono)}")
.SetParameter(nameof(pono), pono)
.FirstOrDefault(x =>
{
identnr = x.GetValue<int?>(0);
menge = x.GetValue<int?>(1);
key = x.GetValue<string>(2);
});
if (identnr is null)
{
error = $"Identnr nicht gefunden für Fertigungsauftragnr: {pono}";
return requirements;
}
else if (menge is null)
{
error = $"Menge ist ungültig für Fertigungsauftragnr: {pono}";
return requirements;
}
else if (key is null)
{
error = $"Region-Size key ist ungültig für Fertigungsauftragnr: {pono}";
return requirements;
}
var standardRequirement = this.dbContext.StandardRequirements.FirstOrDefaultByKey(key);
var specialRequirement = this.dbContext.SpecialRequirements.FindFirstOrDefault(standardRequirement?.Id ?? 0, pono.Value, pcb);
if (specialRequirement?.ApprovedDate is null)
{
specialRequirement = default(CordonelSpecialRequirement);
}
if (specialRequirement is null)
{
if (standardRequirement is null)
{
error = $"Standardfreigabe für Size-Region: {key} nicht gefunden";
return requirements;
}
else if (!standardRequirement.IsActive)
{
error = $"Standardfreigabe {standardRequirement.Id}.{standardRequirement.Version} nicht active";
return requirements;
}
else if (standardRequirement.ApprovedDate is null)
{
error = $"Standardfreigabe {standardRequirement.Id}.{standardRequirement.Version} nicht genehmigt";
return requirements;
}
}
requirements = new CordonelRequirements
{
ApprovalComment = specialRequirement?.Comment ?? standardRequirement?.Comment,
ApprovalName = specialRequirement?.ApprovedBy ?? standardRequirement?.ApprovedBy,
EstimatedProductionBatteryLoadPercent = specialRequirement?.EstimatedProductionBatteryLoadPercent ?? standardRequirement?.EstimatedProductionBatteryLoadPercent,
FwVersion = specialRequirement?.FwVersion ?? standardRequirement?.FwVersion,
IsSpecialApproved = specialRequirement?.ApprovedDate != null,
IsSpecialActive = specialRequirement?.IsActive ?? default(bool?),
IsStandardActive = standardRequirement?.IsActive,
IsStandardApproved = standardRequirement?.ApprovedDate != null,
LutCrc = specialRequirement?.LutCrc ?? standardRequirement?.LutCrc,
MaxDrainedBatteryLoadPercentAssembly = specialRequirement?.MaxDrainedBatteryLoadPercentAssembly
?? standardRequirement?.MaxDrainedBatteryLoadPercentAssembly,
MaxDrainedBatteryLoadPercentShipping = specialRequirement?.MaxDrainedBatteryLoadPercentShipping
?? standardRequirement?.MaxDrainedBatteryLoadPercentShipping,
MaxStorageMonths = menge < 5
? specialRequirement?.MaxStorageMonths ?? standardRequirement?.MaxStorageMonths
: specialRequirement?.MaxStorageMonthsBigOrders ?? standardRequirement?.MaxStorageMonthsBigOrders,
MeterSize = specialRequirement?.MeterSize ?? standardRequirement?.MeterSize,
OuterPcbId = pcb,
OuterProductionOrderNr = pono,
PcbId = specialRequirement?.PcbId,
ProductionOrderNr = specialRequirement?.ProductionOrderNr,
QuiescentCurrent_uA = specialRequirement?.QuiescentCurrent_uA ?? standardRequirement?.QuiescentCurrent_uA,
Region = specialRequirement?.Region ?? standardRequirement?.Region,
RegionSizeKey = key,
RequiredLifeTimeYearsAssembly = specialRequirement?.RequiredLifeTimeYearsAssembly ?? standardRequirement?.RequiredLifeTimeYearsAssembly,
RequiredLifeTimeYearsShipping = specialRequirement?.RequiredLifeTimeYearsShipping ?? standardRequirement?.RequiredLifeTimeYearsShipping,
RequirementTimestamp = specialRequirement?.Timestamp ?? standardRequirement?.Timestamp,
SkipCalibration = specialRequirement?.SkipCalibration ?? standardRequirement?.SkipCalibration ?? false,
SkipRadioCheck = specialRequirement?.SkipRadioCheck ?? standardRequirement?.SkipRadioCheck ?? false,
SpecialId = specialRequirement?.Id,
SpecialVersion = specialRequirement?.Version,
StandardId = standardRequirement?.Id,
StandardVersion = standardRequirement?.Version,
};
return requirements;
}
public CordonelRequirements FindByPoNo(string pono)
=> this.sqlConnection
.CreateCommand($@"
SELECT DISTINCT
cr.SpecialId
, cr.SpecialVersion
, cr.StandardId
, cr.StandardVersion
, cr.Region
, cr.Size
, cr.PoNr
, aap.FertigungsauftragNr
, cr.PcbId
, map.MapPcbIdToSerialNumber_PcbId
, cr.SkipCalibration
, cr.SkipRadioCheck
, cr.FwVersion
, cr.LutCrc
, cr.RLTYA
, cr.RLTYS
, cr.MDBLPA
, cr.MDBLPS
, CASE WHEN aap.Menge < 6
THEN MSM
ELSE MSMBO
END AS MaxStorageMonths
, cr.QuiescentCurrent_uA
, cr.EPBLP
, cr.Timestamp
, cr.CreatedBy
, cr.Comment
, cr.IsSplActive
, cr.IsStdActive
, cr.IsSplApproved
, cr.IsStdApproved
, cr.RegionSizeKey
FROM Cordonel_Requirements AS cr
JOIN AlleAuftragPositionen AS aap
ON cr.IdentNr = aap.IdentNr
JOIN AuftragPositionSerienNr AS aps
ON aap.AuftragNr = aps.AuftragNr
AND aap.PositionNr = aps.PositionNr
JOIN MapPcbIdToSerialNumber AS map
ON aps.SerienNr = map.MapPcbIdToSerialNumber_SerialNumber
WHERE aap.FertigungsauftragNr = @{nameof(pono)}
AND (cr.PoNr = aap.FertigungsauftragNr OR cr.PoNr IS NULL)
AND (cr.PcbId = map.MapPcbIdToSerialNumber_PcbId OR cr.PcbId IS NULL)
ORDER BY cr.StandardId DESC
, cr.SpecialId DESC")
.SetParameter(nameof(pono), pono)
.FirstOrDefault(this.ParseCordonelRequirements);
private CordonelRequirements ParseCordonelRequirements(SqlReader reader)
=> new CordonelRequirements
{
SpecialId = reader.GetValue<int?>(0),
SpecialVersion = reader.GetValue<int?>(1),
StandardId = reader.GetValue<int?>(2),
StandardVersion = reader.GetValue<int?>(3),
Region = reader.GetValue<string>(4),
MeterSize = reader.GetValue<string>(5),
ProductionOrderNr = reader.GetValue<int?>(6),
OuterProductionOrderNr = reader.GetValue<int?>(7),
PcbId = reader.GetValue<int?>(8),
OuterPcbId = reader.GetValue<int?>(9),
SkipCalibration = reader.GetValue<bool>(10),
SkipRadioCheck = reader.GetValue<bool>(11),
FwVersion = reader.GetValue<string>(12),
LutCrc = reader.GetValue<string>(13),
RequiredLifeTimeYearsAssembly = reader.GetValue<Double?>(14),
RequiredLifeTimeYearsShipping = reader.GetValue<Double?>(15),
MaxDrainedBatteryLoadPercentAssembly = reader.GetValue<Double?>(16),
MaxDrainedBatteryLoadPercentShipping = reader.GetValue<Double?>(17),
MaxStorageMonths = reader.GetValue<Double?>(18),
QuiescentCurrent_uA = reader.GetValue<Double?>(19),
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(20),
RequirementTimestamp = reader.GetValue<DateTime?>(21),
ApprovalName = reader.GetValue<string>(22),
ApprovalComment = reader.GetValue<string>(23),
IsSpecialActive = reader.GetValue<bool?>(24),
IsStandardActive = reader.GetValue<bool?>(25),
IsSpecialApproved = reader.GetValue<bool?>(26),
IsStandardApproved = reader.GetValue<bool?>(27),
RegionSizeKey = reader.GetValue<string>(28)
};
}
}
@@ -1,648 +0,0 @@
namespace LaaProduction.Data.Cordonel.Repositories
{
using LaaPackages.Features.Cordonel.Models;
using LaaPackages.SqlClient;
using LaaProduction.Data.Cordonel.Interfaces;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
public class SpecialRequirementsRepository : ISpecialRequirementsRepository<CordonelSpecialRequirement>
{
private readonly CordonelDbContext dbContext;
private readonly SqlConnection sqlConnection;
public SpecialRequirementsRepository(CordonelDbContext dbContext)
{
this.dbContext = dbContext;
this.sqlConnection = dbContext.SqlConnection;
}
public CordonelSpecialRequirement Add(CordonelSpecialRequirement model)
{
var insertedId = this.sqlConnection
.CreateCommand($@"
INSERT
INTO [Cordonel_Special_Requirements]
( [Id]
, [Version]
, [StandardId]
, [StandardVersion]
, [ProductionOrderNo]
, [PcbId]
, [FwVersion]
, [LutCrc]
, [SkipCalibration]
, [SkipRadioCheck]
, [RequiredLifeTimeYearsAssembly]
, [RequiredLifeTimeYearsShipping]
, [MaxDrainedBatteryLoadPercentAssembly]
, [MaxDrainedBatteryLoadPercentShipping]
, [MaxStorageMonths]
, [MaxStorageMonthsBigOrders]
, [QuiescentCurrent_uA]
, [EstimatedProductionBatteryLoadPercent]
, [Timestamp]
, [CreatedBy]
, [Comment]
, [IsActive])
VALUES ((SELECT ISNULL(MAX([Id]), 0) + 1 FROM [Cordonel_Special_Requirements])
, 1
, @{nameof(model.StandardId)}
, @{nameof(model.StandardVersion)}
, @{nameof(model.ProductionOrderNr)}
, @{nameof(model.PcbId)}
, @{nameof(model.FwVersion)}
, @{nameof(model.LutCrc)}
, @{nameof(model.SkipCalibration)}
, @{nameof(model.SkipRadioCheck)}
, @{nameof(model.RequiredLifeTimeYearsAssembly)}
, @{nameof(model.RequiredLifeTimeYearsShipping)}
, @{nameof(model.MaxDrainedBatteryLoadPercentAssembly)}
, @{nameof(model.MaxDrainedBatteryLoadPercentShipping)}
, @{nameof(model.MaxStorageMonths)}
, @{nameof(model.MaxStorageMonthsBigOrders)}
, @{nameof(model.QuiescentCurrent_uA)}
, @{nameof(model.EstimatedProductionBatteryLoadPercent)}
, GETUTCDATE()
, @{nameof(model.CreatedBy)}
, @{nameof(model.Comment)}
, @{nameof(model.IsActive)})")
.SetParameter(nameof(model.StandardId), model.StandardId)
.SetParameter(nameof(model.StandardVersion), model.StandardVersion)
.SetParameter(nameof(model.ProductionOrderNr), model.ProductionOrderNr)
.SetParameter(nameof(model.PcbId), model.PcbId)
.SetParameter(nameof(model.FwVersion), model.FwVersion)
.SetParameter(nameof(model.LutCrc), model.LutCrc)
.SetParameter(nameof(model.SkipCalibration), model.SkipCalibration)
.SetParameter(nameof(model.SkipRadioCheck), model.SkipRadioCheck)
.SetParameter(nameof(model.RequiredLifeTimeYearsAssembly), model.RequiredLifeTimeYearsAssembly)
.SetParameter(nameof(model.RequiredLifeTimeYearsShipping), model.RequiredLifeTimeYearsShipping)
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentAssembly), model.MaxDrainedBatteryLoadPercentAssembly)
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentShipping), model.MaxDrainedBatteryLoadPercentShipping)
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
.SetParameter(nameof(model.MaxStorageMonthsBigOrders), model.MaxStorageMonthsBigOrders)
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
.SetParameter(nameof(model.Timestamp), model.Timestamp)
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
.SetParameter(nameof(model.Comment), model.Comment)
.SetParameter(nameof(model.IsActive), model.IsActive)
.ExecuteScalar(x => x.GetValue<int>(0));
var id = this.sqlConnection
.CreateCommand($@"
SELECT [Id]
FROM [Cordonel_Special_Requirements]
WHERE [ProductionOrderNo] = @{nameof(model.ProductionOrderNr)}
AND ([PcbId] = @{nameof(model.PcbId)} OR [PcbId] IS NULL)")
.SetParameter(nameof(model.ProductionOrderNr), model.ProductionOrderNr)
.SetParameter(nameof(model.PcbId), model.PcbId)
.FirstOrDefault(x => x.GetValue<int>(0));
return this.FirstOrDefault(id);
}
public void Approve(int requirementId, string approval, string comment)
=> this.sqlConnection
.CreateCommand($@"
UPDATE Cordonel_Special_Requirements
SET ApprovedBy = @{nameof(approval)}
, ApprovedDate = GETDATE()
, Comment = ISNULL(Comment, '')
+ CHAR(13) + CHAR(10)
+ ISNULL(@{nameof(comment)}, '')
FROM Cordonel_Special_Requirements AS splup
JOIN (SELECT TOP 1 spl.Id, spl.Version
FROM Cordonel_Special_Requirements AS spl
WHERE spl.Id = @{nameof(requirementId)}
AND spl.CreatedBy <> @{nameof(approval)}
ORDER BY spl.Version DESC) AS idv
ON splup.Id = idv.Id
AND splup.Version = idv.Version")
.SetParameter(nameof(requirementId), requirementId)
.SetParameter(nameof(approval), approval)
.SetParameter(nameof(comment), comment)
.ExecuteNonQuery();
public CordonelSpecialRequirement Delete(object id)
=> throw new NotImplementedException($"{nameof(CordonelSpecialRequirement)} could not be deleted");
public SpecialRequiremetnsFilter Filter()
{
var xmlFilter = this.sqlConnection
.CreateCommand($@"
DECLARE @spl TABLE(
Region VARCHAR(20)
, MeterSize VARCHAR(20)
, ProductionOrder INT
, PcbId INT
, IsActive BIT
, IsApproved BIT)
INSERT INTO @spl
SELECT std.Region
, std.MeterSize
, spl.ProductionOrderNo
, spl.PcbId
, spl.IsActive
, CAST(CASE WHEN spl.ApprovedDate IS NOT NULL THEN 1 ELSE 0 END AS BIT)
FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY Id ORDER BY Version DESC) AS RowNr
FROM Cordonel_Special_Requirements) AS spl
JOIN Cordonel_Standard_Requirements AS std
ON spl.StandardId = std.Id
AND spl.StandardVersion = std.Version
WHERE spl.RowNr = 1
SELECT CAST((SELECT (SELECT DISTINCT Region AS 'Region/@Value'
FROM @spl
FOR XML PATH(''), TYPE) AS Regions
, (SELECT DISTINCT MeterSize AS 'MeterSize/@Value'
FROM @spl
FOR XML PATH(''), TYPE) AS MeterSizes
, (SELECT DISTINCT ProductionOrder AS 'ProductionOrder/@Value'
FROM @spl
FOR XML PATH(''), TYPE) AS ProductionOrders
, (SELECT DISTINCT PcbId AS 'PcbId/@Value'
FROM @spl
FOR XML PATH(''), TYPE) AS PcbIds
, (SELECT DISTINCT IsActive AS 'Active/@Value'
FROM @spl
FOR XML PATH(''), TYPE) AS ActiveRequirements
, (SELECT DISTINCT IsApproved AS 'Approved/@Value'
FROM @spl
FOR XML PATH(''), TYPE) AS ApprovedRequirements
FOR XML PATH(''), ROOT('SpecialRequiremetnsFilter'), TYPE) AS XML)")
.FirstOrDefault(x => x.GetValue<string>(0));
var filter = default(SpecialRequiremetnsFilter);
if (!string.IsNullOrWhiteSpace(xmlFilter))
{
var xmlSerializer = new XmlSerializer(typeof(SpecialRequiremetnsFilter));
var xmlReader = new StringReader(xmlFilter);
try
{
filter = xmlSerializer.Deserialize(xmlReader) as SpecialRequiremetnsFilter;
}
catch // TODO: (Exception e)
{
}
}
return filter ?? new SpecialRequiremetnsFilter();
}
public IEnumerable<CordonelSpecialRequirement> Filter(SpecialRequiremetnsFilter filter)
{
var query = $@"
SELECT *
FROM (SELECT [Latest].[Id]
, [Latest].[Version]
, [Latest].[StandardId]
, [Latest].[StandardVersion]
, [Standards].[Key]
, [Standards].[Region]
, [Standards].[MeterSize]
, [Latest].[ProductionOrderNo]
, [Latest].[PcbId]
, [Latest].[FwVersion]
, [Latest].[LutCrc]
, [Latest].[SkipCalibration]
, [Latest].[SkipRadioCheck]
, [Latest].[RequiredLifeTimeYearsAssembly]
, [Latest].[RequiredLifeTimeYearsShipping]
, [Latest].[MaxDrainedBatteryLoadPercentAssembly]
, [Latest].[MaxDrainedBatteryLoadPercentShipping]
, [Latest].[MaxStorageMonths]
, [Latest].[MaxStorageMonthsBigOrders]
, [Latest].[QuiescentCurrent_uA]
, [Latest].[EstimatedProductionBatteryLoadPercent]
, [Latest].[Timestamp]
, [Latest].[CreatedBy]
, [Latest].[ApprovedBy]
, [Latest].[ApprovedDate]
, [Latest].[Comment]
, [Latest].[IsActive]
, [Standards].[ProductGroup]
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
ORDER BY [Version] DESC) AS [RowNr]
FROM [Cordonel_Special_Requirements])
AS [Latest]
LEFT JOIN [Cordonel_Standard_Requirements]
AS [Standards]
ON [Standards].[Id] = [Latest].[StandardId]
AND [Standards].[Version] = [Latest].[StandardVersion]
WHERE [Latest].[RowNr] = 1)
AS [req]
{filter?.SqlConditions("req", "WHERE")}
ORDER BY [req].[ProductGroup] ASC
, LEN(SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END))
, SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END)
, [req].[MeterSize]";
return this.sqlConnection
.CreateCommand(query)
.ExecuteReader(this.ParseSpecialRequirement);
}
public CordonelSpecialRequirement Find(CordonelSpecialRequirement model)
{
var requirement = this.sqlConnection
.CreateCommand($@"
SELECT [Special].[Id]
, [Special].[Version]
, [Special].[StandardId]
, [Special].[StandardVersion]
, [Standard].[Key]
, [Standard].[Region]
, [Standard].[MeterSize]
, [Special].[ProductionOrderNo]
, [Special].[PcbId]
, [Special].[FwVersion]
, [Special].[LutCrc]
, [Special].[SkipCalibration]
, [Special].[SkipRadioCheck]
, [Special].[RequiredLifeTimeYearsAssembly]
, [Special].[RequiredLifeTimeYearsShipping]
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
, [Special].[MaxDrainedBatteryLoadPercentShipping]
, [Special].[MaxStorageMonths]
, [Special].[MaxStorageMonthsBigOrders]
, [Special].[QuiescentCurrent_uA]
, [Special].[EstimatedProductionBatteryLoadPercent]
, [Special].[Timestamp]
, [Special].[CreatedBy]
, [Special].[ApprovedBy]
, [Special].[ApprovedDate]
, [Special].[Comment]
, [Special].[IsActive]
, [Standard].[ProductGroup]
FROM [Cordonel_Special_Requirements] AS [Special]
LEFT JOIN [Cordonel_Standard_Requirements] AS [Standard]
ON [Standard].[Id] = [Special].[StandardId]
AND [Standard].[Version] = [Special].[StandardVersion]
WHERE ISNULL([Special].[ProductionOrderNo], '') = ISNULL(@{nameof(model.ProductionOrderNr)}, '')
AND ISNULL([Special].[PcbId], '') = ISNULL(@{nameof(model.PcbId)}, '')
ORDER BY [Special].[Version] DESC")
.SetParameter(nameof(model.ProductionOrderNr), model.ProductionOrderNr)
.SetParameter(nameof(model.PcbId), model.PcbId)
.FirstOrDefault(this.ParseSpecialRequirement);
if (requirement != null)
{
requirement.StandardRequirement = this.StandardRequirement(requirement.StandardId);
requirement.History = this.Hostory(requirement.Id, requirement.Version);
}
return requirement;
}
public CordonelSpecialRequirement FirstOrDefault(object id)
{
var requirement = this.sqlConnection
.CreateCommand($@"
SELECT [Special].[Id]
, [Special].[Version]
, [Special].[StandardId]
, [Special].[StandardVersion]
, [Standard].[Key]
, [Standard].[Region]
, [Standard].[MeterSize]
, [Special].[ProductionOrderNo]
, [Special].[PcbId]
, [Special].[FwVersion]
, [Special].[LutCrc]
, [Special].[SkipCalibration]
, [Special].[SkipRadioCheck]
, [Special].[RequiredLifeTimeYearsAssembly]
, [Special].[RequiredLifeTimeYearsShipping]
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
, [Special].[MaxDrainedBatteryLoadPercentShipping]
, [Special].[MaxStorageMonths]
, [Special].[MaxStorageMonthsBigOrders]
, [Special].[QuiescentCurrent_uA]
, [Special].[EstimatedProductionBatteryLoadPercent]
, [Special].[Timestamp]
, [Special].[CreatedBy]
, [Special].[ApprovedBy]
, [Special].[ApprovedDate]
, [Special].[Comment]
, [Special].[IsActive]
, [Standard].[ProductGroup]
FROM [Cordonel_Special_Requirements] AS [Special]
LEFT JOIN [Cordonel_Standard_Requirements] AS [Standard]
ON [Standard].[Id] = [Special].[StandardId]
AND [Standard].[Version] = [Special].[StandardVersion]
WHERE [Special].[Id] = @{nameof(id)}
ORDER BY [Special].[Version] DESC")
.SetParameter(nameof(id), id)
.FirstOrDefault(this.ParseSpecialRequirement);
if (requirement != null)
{
requirement.StandardRequirement = this.StandardRequirement(requirement.StandardId);
requirement.History = this.Hostory(requirement.Id, requirement.Version);
}
return requirement;
}
public CordonelSpecialRequirement FirstOrDefault(params object[] ids)
{
var requirement = this.sqlConnection
.CreateCommand($@"
SELECT [Special].[Id]
, [Special].[Version]
, [Special].[StandardId]
, [Special].[StandardVersion]
, [Standard].[Key]
, [Standard].[Region]
, [Standard].[MeterSize]
, [Special].[ProductionOrderNo]
, [Special].[PcbId]
, [Special].[FwVersion]
, [Special].[LutCrc]
, [Special].[SkipCalibration]
, [Special].[SkipRadioCheck]
, [Special].[RequiredLifeTimeYearsAssembly]
, [Special].[RequiredLifeTimeYearsShipping]
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
, [Special].[MaxDrainedBatteryLoadPercentShipping]
, [Special].[MaxStorageMonths]
, [Special].[MaxStorageMonthsBigOrders]
, [Special].[QuiescentCurrent_uA]
, [Special].[EstimatedProductionBatteryLoadPercent]
, [Special].[Timestamp]
, [Special].[CreatedBy]
, [Special].[ApprovedBy]
, [Special].[ApprovedDate]
, [Special].[Comment]
, [Special].[IsActive]
, [Standard].[ProductGroup]
FROM [Cordonel_Special_Requirements] AS [Special]
LEFT JOIN [Cordonel_Standard_Requirements] AS [Standard]
ON [Standard].[Id] = [Special].[StandardId]
AND [Standard].[Version] = [Special].[StandardVersion]
WHERE [Special].[Id] = @{nameof(CordonelSpecialRequirement.Id)}
AND [Special].[Version] = @{nameof(CordonelSpecialRequirement.Version)}
ORDER BY [Special].[Version] DESC")
.SetParameter(nameof(CordonelSpecialRequirement.Id), ids[0])
.SetParameter(nameof(CordonelSpecialRequirement.Version), ids[1])
.FirstOrDefault(this.ParseSpecialRequirement);
if (requirement != null)
{
requirement.StandardRequirement = this.StandardRequirement(requirement.StandardId);
requirement.History = this.Hostory(requirement.Id, requirement.Version);
}
return requirement;
}
public CordonelSpecialRequirement FindFirstOrDefault(int standardId, int pono, int? pcbId)
=> this.sqlConnection
.CreateCommand($@"
SELECT [Special].[Id]
, [Special].[Version]
, [Special].[StandardId]
, [Special].[StandardVersion]
, NULL
, NULL
, NULL
, [Special].[ProductionOrderNo]
, [Special].[PcbId]
, [Special].[FwVersion]
, [Special].[LutCrc]
, [Special].[SkipCalibration]
, [Special].[SkipRadioCheck]
, [Special].[RequiredLifeTimeYearsAssembly]
, [Special].[RequiredLifeTimeYearsShipping]
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
, [Special].[MaxDrainedBatteryLoadPercentShipping]
, [Special].[MaxStorageMonths]
, [Special].[MaxStorageMonthsBigOrders]
, [Special].[QuiescentCurrent_uA]
, [Special].[EstimatedProductionBatteryLoadPercent]
, [Special].[Timestamp]
, [Special].[CreatedBy]
, [Special].[ApprovedBy]
, [Special].[ApprovedDate]
, [Special].[Comment]
, [Special].[IsActive]
, NULL
FROM [Cordonel_Special_Requirements] AS [Special]
WHERE [Special].[StandardId] = @{nameof(standardId)}
AND [Special].[ProductionOrderNo] = @{nameof(pono)}
AND ([Special].[PcbId] = @{nameof(pcbId)} OR [Special].[PcbId] IS NULL)
ORDER BY [Special].[Version] DESC")
.SetParameter(nameof(standardId), standardId)
.SetParameter(nameof(pono), pono)
.SetParameter(nameof(pcbId), pcbId)
.FirstOrDefault(this.ParseSpecialRequirement);
public CordonelSpecialRequirement FirstOrDefaultByPO(string ponr)
{
var id = default(int?);
var nr = default(int?);
_ = this.sqlConnection
.CreateCommand($@"
SELECT [Id]
, [Version]
FROM [Cordonel_Special_Requirements]
WHERE [ProductionOrderNo] = @{nameof(ponr)}
AND [PcbId] IS NULL")
.SetParameter(nameof(ponr), ponr)
.FirstOrDefault(x =>
{
id = x.GetValue<int?>(0);
nr = x.GetValue<int?>(0);
return false;
});
return this.FirstOrDefault(id, nr);
}
public IEnumerator<CordonelSpecialRequirement> GetEnumerator()
=> this.sqlConnection
.CreateCommand(@"
SELECT [Latest].[Id]
, [Latest].[Version]
, [Latest].[StandardId]
, [Latest].[StandardVersion]
, [Standards].[Key]
, [Standards].[Region]
, [Standards].[MeterSize]
, [Latest].[ProductionOrderNo]
, [Latest].[PcbId]
, [Latest].[FwVersion]
, [Latest].[LutCrc]
, [Latest].[SkipCalibration]
, [Latest].[SkipRadioCheck]
, [Latest].[RequiredLifeTimeYearsAssembly]
, [Latest].[RequiredLifeTimeYearsShipping]
, [Latest].[MaxDrainedBatteryLoadPercentAssembly]
, [Latest].[MaxDrainedBatteryLoadPercentShipping]
, [Latest].[MaxStorageMonths]
, [Latest].[MaxStorageMonthsBigOrders]
, [Latest].[QuiescentCurrent_uA]
, [Latest].[EstimatedProductionBatteryLoadPercent]
, [Latest].[Timestamp]
, [Latest].[CreatedBy]
, [Latest].[ApprovedBy]
, [Latest].[ApprovedDate]
, [Latest].[Comment]
, [Latest].[IsActive]
, [Standards].[ProductGroup]
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
ORDER BY [Version] DESC) AS [RowNr]
FROM [Cordonel_Special_Requirements])
AS [Latest]
LEFT JOIN [Cordonel_Standard_Requirements]
AS [Standards]
ON [Standards].[Id] = [Latest].[StandardId]
AND [Standards].[Version] = [Latest].[StandardVersion]
WHERE [Latest].[RowNr] = 1
ORDER BY [Standards].[Region] ASC
, LEN([Standards].[MeterSize]) ASC
, [Standards].[MeterSize] ASC")
.ExecuteReader(this.ParseSpecialRequirement)
.GetEnumerator();
public void Unapprove(int requirementId)
=> this.sqlConnection
.CreateCommand($@"
UPDATE Cordonel_Special_Requirements
SET ApprovedBy = NULL
, ApprovedDate = NULL
FROM Cordonel_Special_Requirements AS splup
JOIN (SELECT TOP 1 spl.Id, spl.Version
FROM Cordonel_Special_Requirements AS spl
WHERE spl.Id = @{nameof(requirementId)}
ORDER BY spl.Version DESC) AS idv
ON splup.Id = idv.Id
AND splup.Version = idv.Version")
.SetParameter(nameof(requirementId), requirementId)
.ExecuteNonQuery();
public CordonelSpecialRequirement Update(CordonelSpecialRequirement model)
{
this.sqlConnection
.CreateCommand($@"
UPDATE [Cordonel_Special_Requirements]
SET [FwVersion] = @{nameof(model.FwVersion)}
, [LutCrc] = @{nameof(model.LutCrc)}
, [SkipCalibration] = @{nameof(model.SkipCalibration)}
, [SkipRadioCheck] = @{nameof(model.SkipRadioCheck)}
, [RequiredLifeTimeYearsAssembly] = @{nameof(model.RequiredLifeTimeYearsAssembly)}
, [RequiredLifeTimeYearsShipping] = @{nameof(model.RequiredLifeTimeYearsShipping)}
, [MaxDrainedBatteryLoadPercentAssembly] = @{nameof(model.MaxDrainedBatteryLoadPercentAssembly)}
, [MaxDrainedBatteryLoadPercentShipping] = @{nameof(model.MaxDrainedBatteryLoadPercentShipping)}
, [MaxStorageMonths] = @{nameof(model.MaxStorageMonths)}
, [MaxStorageMonthsBigOrders] = @{nameof(model.MaxStorageMonthsBigOrders)}
, [QuiescentCurrent_uA] = @{nameof(model.QuiescentCurrent_uA)}
, [EstimatedProductionBatteryLoadPercent] = @{nameof(model.EstimatedProductionBatteryLoadPercent)}
, [Timestamp] = @{nameof(model.Timestamp)}
, [CreatedBy] = @{nameof(model.CreatedBy)}
, [Comment] = @{nameof(model.Comment)}
, [IsActive] = @{nameof(model.IsActive)}
, [ApprovedBy] = NULL
, [ApprovedDate] = NULL
WHERE [Id] = @{nameof(model.Id)}
AND [Version] = (SELECT MAX([Version])
FROM [Cordonel_Special_Requirements]
WHERE [Id] = @{nameof(model.Id)})")
.SetParameter(nameof(model.FwVersion), model.FwVersion)
.SetParameter(nameof(model.LutCrc), model.LutCrc)
.SetParameter(nameof(model.SkipCalibration), model.SkipCalibration)
.SetParameter(nameof(model.SkipRadioCheck), model.SkipRadioCheck)
.SetParameter(nameof(model.RequiredLifeTimeYearsAssembly), model.RequiredLifeTimeYearsAssembly)
.SetParameter(nameof(model.RequiredLifeTimeYearsShipping), model.RequiredLifeTimeYearsShipping)
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentAssembly), model.MaxDrainedBatteryLoadPercentAssembly)
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentShipping), model.MaxDrainedBatteryLoadPercentShipping)
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
.SetParameter(nameof(model.MaxStorageMonthsBigOrders), model.MaxStorageMonthsBigOrders)
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
.SetParameter(nameof(model.Timestamp), model.Timestamp)
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
.SetParameter(nameof(model.Comment), model.Comment)
.SetParameter(nameof(model.IsActive), model.IsActive)
.SetParameter(nameof(model.Id), model.Id)
.ExecuteNonQuery();
return this.FirstOrDefault(model.Id);
}
IEnumerator IEnumerable.GetEnumerator()
=> this.GetEnumerator();
private IEnumerable<CordonelRequirementsChange> Hostory(int id, int nr)
=> this.sqlConnection
.CreateCommand($@"
SELECT [Id]
, [Version]
, [Timestamp]
, [CreatedBy]
, [ApprovedBy]
, [ApprovedDate]
, [Comment]
, [IsActive]
FROM [Cordonel_Special_Requirements]
WHERE [Id] = @{nameof(id)}
AND [Version] <> @{nameof(nr)}
ORDER BY [Version] DESC")
.SetParameter(nameof(id), id)
.SetParameter(nameof(nr), nr)
.ExecuteReader(x => new CordonelRequirementsChange
{
Id = x.GetValue<int>(0),
Version = x.GetValue<int>(1),
Timestamp = x.GetValue<DateTime>(2),
CreatedBy = x.GetValue<string>(3),
ApprovedBy = x.GetValue<string>(4),
ApprovedDate = x.GetValue<DateTime?>(5),
Comment = x.GetValue<string>(6),
IsActive = x.GetValue<bool>(7),
});
private CordonelSpecialRequirement ParseSpecialRequirement(SqlReader reader)
=> new CordonelSpecialRequirement
{
Id = reader.GetValue<int>(0),
Version = reader.GetValue<int>(1),
StandardId = reader.GetValue<int>(2),
StandardVersion = reader.GetValue<int>(3),
Key = reader.GetValue<string>(4),
Region = reader.GetValue<string>(5),
MeterSize = reader.GetValue<string>(6),
ProductionOrderNr = reader.GetValue<int?>(7),
PcbId = reader.GetValue<int?>(8),
FwVersion = reader.GetValue<string>(9),
LutCrc = reader.GetValue<string>(10),
SkipCalibration = reader.GetValue<bool>(11),
SkipRadioCheck = reader.GetValue<bool>(12),
RequiredLifeTimeYearsAssembly = reader.GetValue<Double?>(13),
RequiredLifeTimeYearsShipping = reader.GetValue<Double?>(14),
MaxDrainedBatteryLoadPercentAssembly = reader.GetValue<Double?>(15),
MaxDrainedBatteryLoadPercentShipping = reader.GetValue<Double?>(16),
MaxStorageMonths = reader.GetValue<Double?>(17),
MaxStorageMonthsBigOrders = reader.GetValue<Double?>(18),
QuiescentCurrent_uA = reader.GetValue<Double?>(19),
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(20),
Timestamp = reader.GetValue<DateTime>(21),
CreatedBy = reader.GetValue<string>(22),
ApprovedBy = reader.GetValue<string>(23),
ApprovedDate = reader.GetValue<DateTime?>(24),
Comment = reader.GetValue<string>(25),
IsActive = reader.GetValue<bool>(26),
ProductGroup = reader.GetValue<string>(27),
};
private CordonelStandardRequirement StandardRequirement(int? standardId)
=> this.dbContext.StandardRequirements.FirstOrDefault(standardId);
}
}
@@ -1,465 +0,0 @@
namespace LaaProduction.Data.Cordonel.Repositories
{
using LaaPackages.Features.Cordonel.Models;
using LaaPackages.SqlClient;
using LaaProduction.Data.Cordonel.Interfaces;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
public class StandardRequirementsRepository : IStandardRequirementRepository<CordonelStandardRequirement>
{
private readonly CordonelDbContext dbContext;
private readonly SqlConnection sqlConnection;
public StandardRequirementsRepository(CordonelDbContext dbContext)
{
this.dbContext = dbContext;
this.sqlConnection = dbContext.SqlConnection;
}
public CordonelStandardRequirement Add(CordonelStandardRequirement _)
=> throw new NotImplementedException($"{nameof(CordonelStandardRequirement)} could not be created.");
public void Approve(int requirementId, string approval, string comment)
=> this.sqlConnection
.CreateCommand($@"
UPDATE Cordonel_Standard_Requirements
SET ApprovedBy = @{nameof(approval)}
, ApprovedDate = GETDATE()
, Comment = ISNULL(Comment, '')
+ CASE WHEN @{nameof(comment)} IS NOT NULL
THEN CHAR(13) + CHAR(10) + ISNULL(@{nameof(comment)}, '')
ELSE '' END
FROM Cordonel_Standard_Requirements AS stdup
JOIN (SELECT TOP 1 std.Id, std.Version
FROM Cordonel_Standard_Requirements AS std
WHERE std.Id = @{nameof(requirementId)}
AND std.CreatedBy <> @{nameof(approval)}
ORDER BY std.Version DESC) AS idv
ON stdup.Id = idv.Id
AND stdup.Version = idv.Version
WHERE stdup.IsActive = 1")
.SetParameter(nameof(requirementId), requirementId)
.SetParameter(nameof(approval), approval)
.SetParameter(nameof(comment), comment)
.ExecuteNonQuery();
public CordonelStandardRequirement Delete(object id)
=> throw new NotImplementedException($"{nameof(CordonelStandardRequirement)} could not be deleted");
public CordonelStandardRequirement FirstOrDefault(object id)
{
var requirement = this.sqlConnection
.CreateCommand($@"
SELECT [Id]
, [Version]
, [Key]
, [Region]
, [ProductGroup]
, [MeterSize]
, [FwVersion]
, [LutCrc]
, [SkipCalibration]
, [SkipRadioCheck]
, [RequiredLifeTimeYearsAssembly]
, [RequiredLifeTimeYearsShipping]
, [MaxDrainedBatteryLoadPercentAssembly]
, [MaxDrainedBatteryLoadPercentShipping]
, [MaxStorageMonths]
, [MaxStorageMonthsBigOrders]
, [QuiescentCurrent_uA]
, [EstimatedProductionBatteryLoadPercent]
, [Timestamp]
, [CreatedBy]
, [ApprovedBy]
, [ApprovedDate]
, [Comment]
, [IsActive]
FROM [Cordonel_Standard_Requirements]
WHERE [Id] = @{nameof(id)}
ORDER BY [Version] DESC")
.SetParameter(nameof(id), id)
.FirstOrDefault(this.ParseStandardRequirement);
if (requirement != null)
{
requirement.History = this.History(requirement.Id, requirement.Version);
}
return requirement;
}
public CordonelStandardRequirement FirstOrDefault(params object[] ids)
{
var requirement = this.sqlConnection
.CreateCommand($@"
SELECT TOP 1
[Id]
, [Version]
, [Key]
, [Region]
, [ProductGroup]
, [MeterSize]
, [FwVersion]
, [LutCrc]
, [SkipCalibration]
, [SkipRadioCheck]
, [RequiredLifeTimeYearsAssembly]
, [RequiredLifeTimeYearsShipping]
, [MaxDrainedBatteryLoadPercentAssembly]
, [MaxDrainedBatteryLoadPercentShipping]
, [MaxStorageMonths]
, [MaxStorageMonthsBigOrders]
, [QuiescentCurrent_uA]
, [EstimatedProductionBatteryLoadPercent]
, [Timestamp]
, [CreatedBy]
, [ApprovedBy]
, [ApprovedDate]
, [Comment]
, [IsActive]
FROM [Cordonel_Standard_Requirements]
WHERE [Id] = @{nameof(CordonelStandardRequirement.Id)}
AND [Version] = @{nameof(CordonelStandardRequirement.Version)}")
.SetParameter(nameof(CordonelStandardRequirement.Id), ids[0])
.SetParameter(nameof(CordonelStandardRequirement.Version), ids[1])
.FirstOrDefault(this.ParseStandardRequirement);
if (requirement != null)
{
requirement.History = this.History(requirement.Id, requirement.Version);
}
return requirement;
}
public CordonelStandardRequirement FirstOrDefaultByPO(string ponr)
{
var requirement = this.sqlConnection
.CreateCommand($@"
SELECT TOP 1
[STD].[Id]
, [STD].[Version]
, [STD].[Key]
, [STD].[Region]
, [STD].[ProductGroup]
, [STD].[MeterSize]
, [STD].[FwVersion]
, [STD].[LutCrc]
, [STD].[SkipCalibration]
, [STD].[SkipRadioCheck]
, [STD].[RequiredLifeTimeYearsAssembly]
, [STD].[RequiredLifeTimeYearsShipping]
, [STD].[MaxDrainedBatteryLoadPercentAssembly]
, [STD].[MaxDrainedBatteryLoadPercentShipping]
, [STD].[MaxStorageMonths]
, [STD].[MaxStorageMonthsBigOrders]
, [STD].[QuiescentCurrent_uA]
, [STD].[EstimatedProductionBatteryLoadPercent]
, [STD].[Timestamp]
, [STD].[CreatedBy]
, [STD].[ApprovedBy]
, [STD].[ApprovedDate]
, [STD].[Comment]
, [STD].[IsActive]
FROM [Cordonel_Standard_Requirements] AS [STD]
JOIN (SELECT [REG].[RegionSize]
FROM [AlleAuftragPositionen] AS [AAP]
JOIN [AllRegionsByIdentNr] AS [REG]
ON [REG].[IdentNr] = [AAP].[IdentNr]
WHERE [FertigungsauftragNr] = @{nameof(ponr)})
AS [Regions]
ON [Regions].[RegionSize] = [STD].[Key]
ORDER BY [Version] DESC")
.SetParameter(nameof(ponr), ponr)
.FirstOrDefault(this.ParseStandardRequirement);
return requirement;
}
public IEnumerator<CordonelStandardRequirement> GetEnumerator()
=> this.sqlConnection
.CreateCommand(@"
SELECT [Id]
, [Version]
, [Key]
, [Region]
, [ProductGroup]
, [MeterSize]
, [FwVersion]
, [LutCrc]
, [SkipCalibration]
, [SkipRadioCheck]
, [RequiredLifeTimeYearsAssembly]
, [RequiredLifeTimeYearsShipping]
, [MaxDrainedBatteryLoadPercentAssembly]
, [MaxDrainedBatteryLoadPercentShipping]
, [MaxStorageMonths]
, [MaxStorageMonthsBigOrders]
, [QuiescentCurrent_uA]
, [EstimatedProductionBatteryLoadPercent]
, [Timestamp]
, [CreatedBy]
, [ApprovedBy]
, [ApprovedDate]
, [Comment]
, [IsActive]
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
ORDER BY [Version] DESC) AS [RowNr]
FROM [Cordonel_Standard_Requirements])
AS [Latest]
WHERE [Latest].[RowNr] = 1
ORDER BY [ProductGroup] ASC
, LEN(SUBSTRING([MeterSize], 1, CASE WHEN CHARINDEX(' ', [MeterSize]) > 0 THEN CHARINDEX(' ', [MeterSize]) - 1 ELSE LEN([MeterSize]) END))
, SUBSTRING([MeterSize], 1, CASE WHEN CHARINDEX(' ', [MeterSize]) > 0 THEN CHARINDEX(' ', [MeterSize]) - 1 ELSE LEN([MeterSize]) END)
, [MeterSize] ASC")
.ExecuteReader(this.ParseStandardRequirement)
.GetEnumerator();
public CordonelStandardRequirement Update(CordonelStandardRequirement model)
{
var rowsAffected = this.sqlConnection
.CreateCommand($@"
UPDATE [Cordonel_Standard_Requirements]
SET [FwVersion] = @{nameof(model.FwVersion)}
, [LutCrc] = @{nameof(model.LutCrc)}
, [SkipCalibration] = @{nameof(model.SkipCalibration)}
, [SkipRadioCheck] = @{nameof(model.SkipRadioCheck)}
, [RequiredLifeTimeYearsAssembly] = @{nameof(model.RequiredLifeTimeYearsAssembly)}
, [RequiredLifeTimeYearsShipping] = @{nameof(model.RequiredLifeTimeYearsShipping)}
, [MaxDrainedBatteryLoadPercentAssembly] = @{nameof(model.MaxDrainedBatteryLoadPercentAssembly)}
, [MaxDrainedBatteryLoadPercentShipping] = @{nameof(model.MaxDrainedBatteryLoadPercentShipping)}
, [MaxStorageMonths] = @{nameof(model.MaxStorageMonths)}
, [MaxStorageMonthsBigOrders] = @{nameof(model.MaxStorageMonthsBigOrders)}
, [QuiescentCurrent_uA] = @{nameof(model.QuiescentCurrent_uA)}
, [EstimatedProductionBatteryLoadPercent] = @{nameof(model.EstimatedProductionBatteryLoadPercent)}
, [Timestamp] = @{nameof(model.Timestamp)}
, [CreatedBy] = @{nameof(model.CreatedBy)}
, [Comment] = @{nameof(model.Comment)}
, [IsActive] = @{nameof(model.IsActive)}
, [ApprovedBy] = NULL
, [ApprovedDate] = NULL
WHERE [Id] = @{nameof(model.Id)}
AND [Version] = (SELECT MAX([Version])
FROM [Cordonel_Standard_Requirements]
WHERE [Id] = @{nameof(model.Id)})")
.SetParameter(nameof(model.FwVersion), model.FwVersion)
.SetParameter(nameof(model.LutCrc), model.LutCrc)
.SetParameter(nameof(model.SkipCalibration), model.SkipCalibration)
.SetParameter(nameof(model.SkipRadioCheck), model.SkipRadioCheck)
.SetParameter(nameof(model.RequiredLifeTimeYearsAssembly), model.RequiredLifeTimeYearsAssembly)
.SetParameter(nameof(model.RequiredLifeTimeYearsShipping), model.RequiredLifeTimeYearsShipping)
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentAssembly), model.MaxDrainedBatteryLoadPercentAssembly)
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentShipping), model.MaxDrainedBatteryLoadPercentShipping)
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
.SetParameter(nameof(model.MaxStorageMonthsBigOrders), model.MaxStorageMonthsBigOrders)
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
.SetParameter(nameof(model.Timestamp), model.Timestamp)
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
.SetParameter(nameof(model.Comment), model.Comment)
.SetParameter(nameof(model.IsActive), model.IsActive)
.SetParameter(nameof(model.Id), model.Id)
.ExecuteNonQuery();
return this.FirstOrDefault(model.Id);
}
IEnumerator IEnumerable.GetEnumerator()
=> this.GetEnumerator();
private CordonelStandardRequirement ParseStandardRequirement(SqlReader reader)
=> new CordonelStandardRequirement
{
Id = reader.GetValue<int>(0),
Version = reader.GetValue<int>(1),
Key = reader.GetValue<string>(2),
Region = reader.GetValue<string>(3),
ProductGroup = reader.GetValue<string>(4),
MeterSize = reader.GetValue<string>(5),
FwVersion = reader.GetValue<string>(6),
LutCrc = reader.GetValue<string>(7),
SkipCalibration = reader.GetValue<bool?>(8),
SkipRadioCheck = reader.GetValue<bool?>(9),
RequiredLifeTimeYearsAssembly = reader.GetValue<Double>(10),
RequiredLifeTimeYearsShipping = reader.GetValue<Double>(11),
MaxDrainedBatteryLoadPercentAssembly = reader.GetValue<Double>(12),
MaxDrainedBatteryLoadPercentShipping = reader.GetValue<Double>(13),
MaxStorageMonths = reader.GetValue<Double>(14),
MaxStorageMonthsBigOrders = reader.GetValue<Double>(15),
QuiescentCurrent_uA = reader.GetValue<Double?>(16),
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(17),
Timestamp = reader.GetValue<DateTime>(18),
CreatedBy = reader.GetValue<string>(19),
ApprovedBy = reader.GetValue<string>(20),
ApprovedDate = reader.GetValue<DateTime?>(21),
Comment = reader.GetValue<string>(22),
IsActive = reader.GetValue<bool>(23),
};
private IEnumerable<CordonelRequirementsChange> History(int id, int nr)
=> this.sqlConnection
.CreateCommand($@"
SELECT [Id]
, [Version]
, [Timestamp]
, [CreatedBy]
, [Comment]
, [IsActive]
FROM [Cordonel_Standard_Requirements]
WHERE [Id] = @{nameof(id)}
AND [Version] <> @{nameof(nr)}
ORDER BY [Version] DESC")
.SetParameter(nameof(id), id)
.SetParameter(nameof(nr), nr)
.ExecuteReader(reader => new CordonelRequirementsChange
{
Id = reader.GetValue<int>(0),
Version = reader.GetValue<int>(1),
Timestamp = reader.GetValue<DateTime>(2),
CreatedBy = reader.GetValue<string>(3),
ApprovedBy = reader.GetValue<string>(4),
ApprovedDate = reader.GetValue<DateTime?>(5),
Comment = reader.GetValue<string>(6),
IsActive = reader.GetValue<bool>(7),
});
public void Unapprove(int requirementId)
=> this.sqlConnection
.CreateCommand($@"
UPDATE Cordonel_Standard_Requirements
SET ApprovedBy = NULL
, ApprovedDate = NULL
FROM Cordonel_Standard_Requirements AS stdup
JOIN (SELECT TOP 1 std.Id, std.Version
FROM Cordonel_Standard_Requirements AS std
WHERE std.Id = @{nameof(requirementId)}
ORDER BY std.Version DESC) AS idv
ON stdup.Id = idv.Id
AND stdup.Version = idv.Version
WHERE stdup.IsActive = 1")
.SetParameter(nameof(requirementId), requirementId)
.ExecuteNonQuery();
public StandardRequiremetnsFilter Filter()
{
var xmlFilter = this.sqlConnection
.CreateCommand($@"
SELECT CAST((SELECT (SELECT DISTINCT Region AS 'Region/@Value'
FROM Cordonel_Standard_Requirements
FOR XML PATH(''), TYPE) AS Regions
, (SELECT DISTINCT MeterSize AS 'MeterSize/@Value'
FROM Cordonel_Standard_Requirements
FOR XML PATH(''), TYPE) AS MeterSizes
, (SELECT DISTINCT IsActive AS 'Active/@Value'
FROM Cordonel_Standard_Requirements
FOR XML PATH(''), TYPE) AS ActiveRequirements
, (SELECT DISTINCT CAST(CASE WHEN ApprovedDate IS NULL THEN 0 ELSE 1 END AS BIT) AS 'Approved/@Value'
FROM Cordonel_Standard_Requirements
FOR XML PATH(''), TYPE) AS ApprovedRequirements
FOR XML PATH(''), ROOT('StandardRequiremetnsFilter'), TYPE) AS XML)")
.FirstOrDefault(x => x.GetValue<string>(0));
var filter = default(StandardRequiremetnsFilter);
if (!string.IsNullOrWhiteSpace(xmlFilter))
{
var xmlSerializer = new XmlSerializer(typeof(StandardRequiremetnsFilter));
var xmlReader = new StringReader(xmlFilter);
try
{
filter = xmlSerializer.Deserialize(xmlReader) as StandardRequiremetnsFilter;
}
catch // TODO: (Exception _)
{
}
}
return filter ?? new StandardRequiremetnsFilter();
}
public IEnumerable<CordonelStandardRequirement> Filter(StandardRequiremetnsFilter filter)
{
var query = $@"
SELECT *
FROM (SELECT [Id]
, [Version]
, [Key]
, [Region]
, [ProductGroup]
, [MeterSize]
, [FwVersion]
, [LutCrc]
, [SkipCalibration]
, [SkipRadioCheck]
, [RequiredLifeTimeYearsAssembly]
, [RequiredLifeTimeYearsShipping]
, [MaxDrainedBatteryLoadPercentAssembly]
, [MaxDrainedBatteryLoadPercentShipping]
, [MaxStorageMonths]
, [MaxStorageMonthsBigOrders]
, [QuiescentCurrent_uA]
, [EstimatedProductionBatteryLoadPercent]
, [Timestamp]
, [CreatedBy]
, [ApprovedBy]
, [ApprovedDate]
, [Comment]
, [IsActive]
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
ORDER BY [Version] DESC) AS [RowNr]
FROM [Cordonel_Standard_Requirements])
AS [Latest]
WHERE [Latest].[RowNr] = 1)
AS [req]
{filter?.SqlConditions("req", "WHERE")}
ORDER BY [req].[ProductGroup] ASC
, LEN(SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END))
, SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END)
, [req].[MeterSize] ASC";
return this.sqlConnection
.CreateCommand(query)
.ExecuteReader(this.ParseStandardRequirement);
}
public CordonelStandardRequirement FirstOrDefaultByKey(string key)
=> this.sqlConnection
.CreateCommand($@"
SELECT TOP 1
[STD].[Id]
, [STD].[Version]
, [STD].[Key]
, [STD].[Region]
, [STD].[ProductGroup]
, [STD].[MeterSize]
, [STD].[FwVersion]
, [STD].[LutCrc]
, [STD].[SkipCalibration]
, [STD].[SkipRadioCheck]
, [STD].[RequiredLifeTimeYearsAssembly]
, [STD].[RequiredLifeTimeYearsShipping]
, [STD].[MaxDrainedBatteryLoadPercentAssembly]
, [STD].[MaxDrainedBatteryLoadPercentShipping]
, [STD].[MaxStorageMonths]
, [STD].[MaxStorageMonthsBigOrders]
, [STD].[QuiescentCurrent_uA]
, [STD].[EstimatedProductionBatteryLoadPercent]
, [STD].[Timestamp]
, [STD].[CreatedBy]
, [STD].[ApprovedBy]
, [STD].[ApprovedDate]
, [STD].[Comment]
, [STD].[IsActive]
FROM [Cordonel_Standard_Requirements] AS [STD]
WHERE [STD].[Key] = @{nameof(key)}
ORDER BY [STD].[Version] DESC")
.SetParameter(nameof(key), key)
.FirstOrDefault(this.ParseStandardRequirement);
}
}
@@ -1,32 +0,0 @@
namespace LaaProduction.Data.Cordonel.Sentinel
{
using LaaPackages.Features.Cordonel;
using LaaPackages.HttpClient;
internal class LocalhostHttpClient
{
private readonly HttpConnection httpConnection;
public LocalhostHttpClient(HttpConnection httpConnection)
=> this.httpConnection = httpConnection;
internal virtual CordonelAppsDictionary GetCordonelAppsDictionaryDefaults()
{
var response = this.httpConnection.Get<CordonelAppsDictionary>(request => request.SetPath("/laaproductionweb/api/resources/cordonelappsdictionary"));
if (response.HasValue)
{
return response.Value;
}
var exception = response.Exception;
if (exception != null)
{
throw new SentinelException(exception.GetType().Name, exception.Message);
}
throw new SentinelException(nameof(CordonelAppsDictionary), $"{nameof(CordonelAppsDictionary)} kann nicht geladen werden");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,13 +0,0 @@
namespace LaaProduction.Data.Cordonel.Sentinel
{
using System;
public class SentinelException : Exception
{
public SentinelException(string key, string message)
: base(message)
=> this.Key = key;
public string Key { get; set; }
}
}
@@ -1,102 +0,0 @@
namespace LaaProduction.Data.Cordonel.Sentinel
{
using LaaPackages.Features.Cordonel;
using LaaPackages.Features.Cordonel.Models;
using LaaPackages.HttpClient;
using System.Collections.Generic;
public class SentinelHttpClient
{
private readonly HttpConnection httpConnection;
public SentinelHttpClient(HttpConnection httpConnection)
=> this.httpConnection = httpConnection;
internal CordonelPasswordFile GetCordonelPasswordFile(int pcbId)
{
var response = this.httpConnection.Get<CordonelPasswordFile>(request => request
.SetPath("/MeterProcessState/api/Password/GetPasswordHashFileContent")
.SetQueryParameter(nameof(pcbId), pcbId));
if (response.HasValue)
{
return response.Value;
}
var exception = response.Exception;
if (exception != null)
{
throw new SentinelException(exception.GetType().Name, exception.Message);
}
throw new SentinelException(nameof(CordonelAppsDictionary), $"{nameof(CordonelAppsDictionary)} kann nicht geladen werden");
}
internal virtual IEnumerable<CordonelProgrammingParameter> GetCordonelProgrammingParameters(int pcbId)
{
var response = this.httpConnection.Get<CordonelProgrammingParameter[]>(request => request
.SetPath("/MeterProcessState/api/FinalCheck/GetProgrammingParameters")
.SetQueryParameter(nameof(pcbId), pcbId));
if (response.HasValue)
{
return response.Value;
}
var exception = response.Exception;
if (exception != null)
{
throw new SentinelException(exception.GetType().Name, exception.Message);
}
throw new SentinelException(nameof(CordonelAppsDictionary), $"{nameof(CordonelAppsDictionary)} kann nicht geladen werden");
}
internal virtual int GetLastState(int pcbId)
{
var response = this.httpConnection.Get<int>(request => request
.SetPath("/MeterProcessState/api/ProccesState/GetLastState")
.SetQueryParameter(nameof(pcbId), pcbId));
if (response.HasValue)
{
return response.Value;
}
var exception = response.Exception;
if (exception != null)
{
throw new SentinelException(nameof(SentinelHttpClient), exception.Message);
}
throw new SentinelException(nameof(SentinelHttpClient), $"Last meter process state kann nicht geladen werden");
}
internal virtual bool MakeSAPExport(int pcbId, int state, string version)
{
var response = this.httpConnection.Get<int>(request => request
.SetPath("/MeterProcessState/api/ProccesState/SetState")
.SetQueryParameter(nameof(pcbId), pcbId)
.SetQueryParameter(nameof(state), state)
.SetQueryParameter(nameof(version), version));
var exception = response.Exception;
if (exception != null)
{
throw new SentinelException(nameof(SentinelHttpClient), exception.Message);
}
return response.Succeeded;
}
internal CordonelMetrologyValues GetLatestGenesisFlowValues(int pcbId)
=> this.httpConnection.Get<CordonelMetrologyValues>(request => request
.SetPath($"/MeterProcessState/api/FinalCheck/CalibrationResults/{pcbId}"))
.Value;
}
}
@@ -1,52 +0,0 @@
namespace LaaProduction.Data.Cordonel.Sentinel
{
using System.Collections.Generic;
public class SentinelResult : Dictionary<string, object>
{
public SentinelResult(int? pcbId = null)
{
this.PcbId = pcbId;
this.Succeeded = this.PcbId != null;
if (!this.Succeeded)
{
this[nameof(PcbId)] = $"{this.PcbId} ist ungültig";
}
}
public int? PcbId
{
get => this.TryGetValue(nameof(PcbId), out var value)
&& value is int pcbId
? pcbId
: default(int?);
set => this[nameof(PcbId)] = value;
}
public bool Succeeded
{
get => this.TryGetValue(nameof(Succeeded), out var value)
&& value is bool succeeded
? succeeded
: false;
set => this[nameof(Succeeded)] = value;
}
internal void Add(IDictionary<string, object> dictionary)
{
if (dictionary is null || dictionary.Count <= 0)
{
return;
}
foreach (var kvp in dictionary)
{
if (!string.IsNullOrWhiteSpace(kvp.Key))
{
this[kvp.Key] = kvp.Value;
}
}
}
}
}
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" requireReinstallation="true" />
</packages>
@@ -1,44 +0,0 @@
namespace LaaProduction.Data.Inspection
{
public class InspectionDbContext
{
}
}
/**
* Pruefgang
* |_ PruefgangNr
* |_ PruefstationNr
* |_ Pruefstation
* |_ Nr
* |_ Typ
* |_ Gesperrt
* |_ Bemerkung
* |_ PrueferNr
* |_ Pruefer
* |_ Nr
* |_ Name
* |_ Vorname
* |_ IstPruefer
* |_ Pruefzeit
* |_ PruefgangLang
* |_ Datum
* |_ Typ
* |_ Nennweite
* |_ Nenntemperatur
* |_ Lufttemperatur
* |_ LuftDruck
* |_ RelativeFeuchte
* |_ Vorlauftemperatur
* |_ Einbaulage_alt
* |_ Anzahl
* |_ Bemerkung
* |_ DBasePruefgangNr
* |_ KalibrierID
* |_ Metrolog
* |_ FPP
* |_ Korrigiert
* |_ Typzusatz
* |_ Baulaenge
* |_ Pruefpunkte[1..10]
*/
@@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{25BACE1B-1961-411A-8AC0-1375A1898F8F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaaProduction.Data.Inspection</RootNamespace>
<AssemblyName>LaaProduction.Data.Inspection</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>IDE0003;IDE0049;</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="InspectionDbContext.cs" />
<Compile Include="Pruefer.cs" />
<Compile Include="Prueffehler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PruefgangPP.cs" />
<Compile Include="Pruefgang.cs" />
<Compile Include="Pruefklasse.cs" />
<Compile Include="Pruefstation.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LaaProduction.Data.Inspection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LaaProduction.Data.Inspection")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("25bace1b-1961-411a-8ac0-1375a1898f8f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,15 +0,0 @@
namespace LaaProduction.Data.Inspection
{
using System;
public class Pruefer
{
public short PrueferNr { get; set; }
public string Vorname { get; set; }
public string Name { get; set; }
public bool IstPruefer { get; set; }
}
}
@@ -1,31 +0,0 @@
namespace LaaProduction.Data.Inspection
{
using System;
public class Prueffehler
{
public int SerienNr { get; set; }
public int PruefgangNr { get; set; }
public Pruefgang Pruefgang { get; set; }
public Single?[] PP_Fehler { get; } = new Single?[10];
public DateTime PruefDatum { get; set; }
public DateTime PruefprotokollGedrucktDatum { get; set; }
public DateTime AusdruckPruefstationDatum { get; set; }
public string Info { get; set; }
public string Metrolog { get; set; }
public int FreigabeMitarbeiter { get; set; }
public DateTime FreigabeDatum { get; set; }
public short _LWL { get; set; }
}
}
@@ -1,59 +0,0 @@
namespace LaaProduction.Data.Inspection
{
using System;
public class Pruefgang
{
public int PruefgangNr { get; set; }
public short PruefstationNr { get; set; }
public Pruefstation Pruefstation { get; set; }
public short PrueferNr { get; set; }
public Pruefer Pruefer { get; set; }
public int Pruefzeit { get; set; }
public bool PruefgangLang { get; set; }
public DateTime Datum { get; set; }
public string Typ { get; set; }
public short Nennweite { get; set; }
public byte Nenntemperatur { get; set; }
public Double Lufttemperatur { get; set; }
public Double LuftDruck { get; set; }
public Double RelativeFeuchte { get; set; }
public Double Vorlauftemperatur { get; set; }
public char Einbaulage_alt { get; set; }
public byte Anzahl { get; set; }
public string Bemerkung { get; set; }
public int DBasePruefgangNr { get; set; }
public byte KalibrierID { get; set; }
public string Metrolog { get; set; }
public string FPP { get; set; }
public bool Korrigiert { get; set; }
public string Typzusatz { get; set; }
public short Baulaenge { get; set; }
public PruefgangPP[] Pruefpunkte { get; } = new PruefgangPP[10];
}
}
@@ -1,33 +0,0 @@
namespace LaaProduction.Data.Inspection
{
using System;
public class PruefgangPP
{
public int Nr { get; set; }
public int PruefgangNr { get; set; }
public int PruefpunktNr { get; set; }
public Double Zeit { get; set; }
public Double Soll { get; set; }
public Double Ist { get; set; }
public int RefZSerienNr { get; set; }
public Double RefFehl { get; set; }
public Double Ist_V { get; set; }
public byte Waage { get; set; }
public char Info { get; set; }
public Double T_Start { get; set; }
public Double T_Ende { get; set; }
}
}
@@ -1,7 +0,0 @@
namespace LaaProduction.Data.Inspection
{
public class Pruefklasse
{
}
}
@@ -1,17 +0,0 @@
namespace LaaProduction.Data.Inspection
{
using System;
public class Pruefstation
{
public short PruefstationNr { get; set; }
public short PruefstationTyp { get; set; }
public short ScanKennung { get; set; }
public string Bemerkung { get; set; }
public bool Gesperrt { get; set; }
}
}
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB91E680-2715-4E94-988A-401C0F4A0707}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaaProduction.Data.Omni</RootNamespace>
<AssemblyName>LaaProduction.Data.Omni</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>IDE0003;IDE0049;</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Models\InspectionOrder.cs" />
<Compile Include="Models\TestedPoint.cs" />
<Compile Include="Models\TestedRun.cs" />
<Compile Include="Models\TestMeter.cs" />
<Compile Include="Models\TestPoint.cs" />
<Compile Include="Models\TestRun.cs" />
<Compile Include="OmniDbContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
<Name>LaaPackages.SqlClient</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,88 +0,0 @@
namespace LaaProduction.Data.Omni.Models
{
using System;
using System.Collections.Generic;
public class InspectionOrder
{
public short Id { get; set; }
public int? Orderno { get; set; }
public short? Posno { get; set; }
public int? Pono { get; set; }
public int IdentNr { get; set; }
public string Name { get; set; }
public string Variant { get; set; }
public string SizeName { get; set; }
public byte Size { get; set; }
public byte Range { get; set; }
public byte Direction { get; set; }
public byte IntPart { get; set; }
public int Fraction { get; set; }
public short Crf { get; set; }
public byte Ppr { get; set; }
public byte MeterUnits { get; set; }
public byte FlowUnits { get; set; }
public byte FlowRate { get; set; }
public byte PulseWeight { get; set; }
public byte PulseWidth { get; set; }
public byte PulseUpdate { get; set; }
public byte AlarmPercistancePeriodDays { get; set; }
public int DataLogIntervalMinutes { get; set; }
public short NumberOfReadingDigits { get; set; }
public int OptionalUniDirFields { get; set; }
public string ReadingPreset { get; set; }
public string DeviceID { get; set; }
public Single LeakAlarmGPM { get; set; }
public long LeakAlarmTime { get; set; }
public Single HighFlowAlarmGPM { get; set; }
public long HighFlowAlarmTime { get; set; }
public Single ReverseFlowAlarmGPM { get; set; }
public long ReverseFlowAlarmTime { get; set; }
public string PartNr { get; set; }
public string Configiguration { get; set; }
public string DescriptionL1 { get; set; }
public string DescriptionL2 { get; set; }
public string DescriptionL3 { get; set; }
public string TestClass { get; set; }
public List<TestPoint> TestPoints { get; set; }
}
}
@@ -1,19 +0,0 @@
namespace LaaProduction.Data.Omni.Models
{
using System;
public class TestMeter
{
public int RunId { get; set; }
public short DefaultId { get; set; }
public string PsNr { get; set; }
public int SlotNr { get; set; }
public string BuildInfo { get; set; }
public DateTime AddDate { get; set; }
}
}
@@ -1,21 +0,0 @@
namespace LaaProduction.Data.Omni.Models
{
using System;
public class TestPoint
{
public short Id { get; set; }
public int Nr { get; set; }
public Single GPM { get; set; }
public short Rotations { get; set; }
public short Duration { get; set; }
public Single MinAcc { get; set; }
public Single MaxAcc { get; set; }
}
}
@@ -1,27 +0,0 @@
using System;
namespace LaaProduction.Data.Omni.Models
{
public class TestRun
{
public int Id { get; set; }
public int Pruefgang { get; set; }
public int Pruefer { get; set; }
public string Pruefklasse { get; set; }
public short DefaultId { get; set; }
public string PSNO { get; set; }
public byte Slot { get; set; }
public string Pcb { get; set; }
public DateTime AddDate { get; set; }
public DateTime ManifacturingDate { get; set; }
}
}
@@ -1,27 +0,0 @@
namespace LaaProduction.Data.Omni.Models
{
using System;
public class TestedPoint
{
public int RunId { get; set; }
public string Pcb { get; set; }
public int Id { get; set; }
public int Nr{ get; set; }
public int Rotations { get; set; }
public Double Duration { get; set; }
public Double M3S { get; set; }
public Double M3SRef { get; set; }
public Double ACC { get; set; }
public string Debug { get; set; }
}
}
@@ -1,19 +0,0 @@
namespace LaaProduction.Data.Omni.Models
{
using System;
public class TestedRun
{
public int RunId { get; set; }
public string Pcb { get; set; }
public Double[] ACC { get; set; }
public Double CrrF { get; set; }
public bool Succeeded { get; set; }
public string Debug { get; set; }
}
}
@@ -1,432 +0,0 @@
namespace LaaProduction.Data.Omni
{
using LaaPackages.SqlClient;
using LaaProduction.Data.Omni.Models;
using System;
using System.Collections.Generic;
using System.Linq;
public class OmniDbContext
{
private readonly SqlConnection sql;
public OmniDbContext(string connectionString, Action<string> sqlErrorHandler)
=> this.sql = new SqlConnection(connectionString, sqlErrorHandler);
public TestRun CreateTestRun(TestRun testRun)
{
var created = this.sql
.CreateCommand($@"
INSERT
INTO [OmniTestRuns]
( [Id]
, [PsNr]
, [SlotNr]
, [BuildInfo]
, [DefaultId]
, [Pruefgang]
, [Pruefklasse]
, [Pruefer]
, [ManifacturingTime])
OUTPUT [inserted].[Id]
, [inserted].[AddDate]
, [inserted].[ManifacturingTime]
VALUES ((SELECT MAX([Id]) + 1 FROM [OmniTestRuns])
, @{nameof(testRun.PSNO)}
, @{nameof(testRun.Slot)}
, @{nameof(testRun.Pcb)}
, @{nameof(testRun.DefaultId)}
, @{nameof(testRun.Pruefgang)}
, @{nameof(testRun.Pruefklasse)}
, @{nameof(testRun.Pruefer)}
, @{nameof(testRun.ManifacturingDate)})")
.SetParameter(nameof(testRun.Id), testRun.Id)
.SetParameter(nameof(testRun.PSNO), testRun.PSNO)
.SetParameter(nameof(testRun.Slot), testRun.Slot)
.SetParameter(nameof(testRun.Pcb), testRun.Pcb)
.SetParameter(nameof(testRun.DefaultId), testRun.DefaultId)
.SetParameter(nameof(testRun.Pruefgang), testRun.Pruefgang)
.SetParameter(nameof(testRun.Pruefklasse), testRun.Pruefklasse)
.SetParameter(nameof(testRun.Pruefer), testRun.Pruefer)
.SetParameter(nameof(testRun.ManifacturingDate), testRun.ManifacturingDate)
.FirstOrDefault(x =>
{
testRun.Id = x.GetValue<int>(0);
testRun.AddDate = x.GetValue<DateTime>(1);
testRun.ManifacturingDate = x.GetValue<DateTime>(2);
return true;
});
return testRun;
}
public int CreateTestRun(int psno, int tester, string @class, int count)
{
if (psno == 0)
{
psno = 1000;
}
var like = $"{psno}%";
var pruefgang = this.sql
.CreateCommand($@"
INSERT
INTO [Pruefgang]
( [PruefgangNr]
, [PruefstationNr]
, [PrueferNr]
, [Datum]
, [Typ]
, [Nennweite]
, [Anzahl])
OUTPUT [inserted].[PruefgangNr]
SELECT [x].[PruefgangNr]
, [x].[PruefstationNr]
, [x].[PrueferNr]
, [x].[Datum]
, [x].[Typ]
, [x].[Nennweite]
, [x].[Anzahl]
FROM (SELECT TOP 1
(SELECT TOP 1 [PruefgangNr] + 1
FROM [Pruefgang]
WHERE [PruefgangNr] LIKE @{nameof(like)}
ORDER BY 1 DESC) AS [PruefgangNr]
, @{nameof(psno)} AS [PruefstationNr]
, @{nameof(tester)} AS [PrueferNr]
, GETDATE() AS [Datum]
, [id].[Typ] AS [Typ]
, [id].[Nennweite] AS [Nennweite]
, @{nameof(count)} AS [Anzahl]
FROM [OmniTestPoints] AS [tp]
JOIN [OmniDefaults] AS [od]
ON [tp].[DefaultId] = [od].[Id]
JOIN [Identnr] AS [id]
ON [od].[IdentNr] = [id].[IdentNr]
WHERE [TestClass] = @{nameof(@class)})
AS [x]")
.SetParameter(nameof(psno), (short)psno)
.SetParameter(nameof(tester), (short)tester)
.SetParameter(nameof(@class), @class)
.SetParameter(nameof(like), like)
.SetParameter(nameof(count), (byte)count)
.FirstOrDefault(x => x.GetValue<int>(0));
return pruefgang;
}
public InspectionOrder GetInspectionOrderForClass(string search)
{
var inspectionOrder = default(InspectionOrder);
var inspectionOrderRows = this.sql
.CreateCommand($@"
SELECT [od].[Id]
, [od].[IdentNr]
, [od].[Name]
, [od].[Variant]
, [od].[SizeName]
, [od].[Size]
, [od].[Range]
, [od].[Direction]
, [od].[IntPart]
, [od].[Fraction]
, [od].[Crf]
, [od].[Ppr]
, [od].[MeterUnits]
, [od].[FlowUnits]
, [od].[FlowRate]
, [od].[PulseWeight]
, [od].[PulseWidth]
, [od].[PulseUpdate]
, [od].[AlarmPercistancePeriodDays]
, [od].[DataLogIntervalMinutes]
, [od].[NumberOfReadingDigits]
, [od].[OptionalUniDirFields]
, [od].[ReadingPreset]
, [od].[DeviceID]
, [od].[LeakAlarmGPM]
, [od].[LeakAlarmTime]
, [od].[HighFlowAlarmGPM]
, [od].[HighFlowAlarmTime]
, [od].[ReverseFlowAlarmGPM]
, [od].[ReverseFlowAlarmTime]
, [od].[DescriptionL1]
, [od].[DescriptionL2]
, [od].[DescriptionL3]
, [tp].[TestClass]
, [tp].[Id]
, ROW_NUMBER() OVER (PARTITION BY [od].[Id] ORDER BY [tp].[GPM]) AS [Nr]
, [tp].[GPM]
, [tp].[Rotations]
, [tp].[Duration]
, [tp].[MinAcc]
, [tp].[MaxAcc]
FROM [OmniDefaults] AS [od]
JOIN [OmniTestPoints] AS [tp]
ON [od].[Id] = [tp].[DefaultId]
WHERE [tp].[TestClass] = @{nameof(search)}
ORDER BY[tp].[GPM] DESC")
.SetParameter(nameof(search), search)
.ExecuteReader(x =>
{
if (inspectionOrder is null)
{
inspectionOrder = new InspectionOrder
{
Id = x.GetValue<short>(0),
IdentNr = x.GetValue<int>(1),
Name = x.GetValue<string>(2),
Variant = x.GetValue<string>(3),
SizeName = x.GetValue<string>(4),
Size = x.GetValue<byte>(5),
Range = x.GetValue<byte>(6),
Direction = x.GetValue<byte>(7),
IntPart = x.GetValue<byte>(8),
Fraction = x.GetValue<int>(9),
Crf = x.GetValue<short>(10),
Ppr = x.GetValue<byte>(11),
MeterUnits = x.GetValue<byte>(12),
FlowUnits = x.GetValue<byte>(13),
FlowRate = x.GetValue<byte>(14),
PulseWeight = x.GetValue<byte>(15),
PulseWidth = x.GetValue<byte>(16),
PulseUpdate = x.GetValue<byte>(17),
AlarmPercistancePeriodDays = x.GetValue<byte>(18),
DataLogIntervalMinutes = x.GetValue<int>(19),
NumberOfReadingDigits = x.GetValue<short>(20),
OptionalUniDirFields = x.GetValue<int>(21),
ReadingPreset = x.GetValue<string>(22),
DeviceID = x.GetValue<string>(23),
LeakAlarmGPM = x.GetValue<Single>(24),
LeakAlarmTime = x.GetValue<long>(25),
HighFlowAlarmGPM = x.GetValue<Single>(26),
HighFlowAlarmTime = x.GetValue<long>(27),
ReverseFlowAlarmGPM = x.GetValue<Single>(28),
ReverseFlowAlarmTime = x.GetValue<long>(29),
DescriptionL1 = x.GetValue<string>(30),
DescriptionL2 = x.GetValue<string>(31),
DescriptionL3 = x.GetValue<string>(32),
TestClass = x.GetValue<string>(33)
};
}
if (inspectionOrder.TestPoints is null)
{
inspectionOrder.TestPoints = new List<TestPoint>();
}
inspectionOrder.TestPoints.Add(new TestPoint
{
Id = x.GetValue<short>(34),
Nr = x.GetValue<int>(35),
GPM = x.GetValue<Single>(36),
Rotations = x.GetValue<short>(37),
Duration = x.GetValue<short>(38),
MinAcc = x.GetValue<Single>(39),
MaxAcc = x.GetValue<Single>(40),
});
return true;
})
.ToList();
return inspectionOrder;
}
public InspectionOrder GetInspectionOrderForPO(int pono)
{
var inspectionOrder = default(InspectionOrder);
var inspectionOrderRows = this.sql
.CreateCommand($@"
SELECT [d].[Id]
, [aap].[AuftragNr]
, [aap].[PositionNr]
, [aap].[FertigungsauftragNr]
, [d].[IdentNr]
, [d].[Name]
, [d].[Variant]
, [d].[SizeName]
, [d].[Size]
, [d].[Range]
, [d].[Direction]
, [d].[IntPart]
, [d].[Fraction]
, [d].[Crf]
, [d].[Ppr]
, [d].[MeterUnits]
, [d].[FlowUnits]
, [d].[FlowRate]
, [d].[PulseWeight]
, [d].[PulseWidth]
, [d].[PulseUpdate]
, [d].[AlarmPercistancePeriodDays]
, [d].[DataLogIntervalMinutes]
, [d].[NumberOfReadingDigits]
, [d].[OptionalUniDirFields]
, [d].[ReadingPreset]
, [d].[DeviceID]
, [d].[LeakAlarmGPM]
, [d].[LeakAlarmTime]
, [d].[HighFlowAlarmGPM]
, [d].[HighFlowAlarmTime]
, [d].[ReverseFlowAlarmGPM]
, [d].[ReverseFlowAlarmTime]
, [d].[DescriptionL1]
, [d].[DescriptionL2]
, [d].[DescriptionL3]
, [tp].[TestClass]
, [tp].[Id]
, ROW_NUMBER() OVER (PARTITION BY [d].[Id] ORDER BY [tp].[GPM]) AS [Nr]
, [tp].[GPM]
, [tp].[Rotations]
, [tp].[Duration]
, [tp].[MinAcc]
, [tp].[MaxAcc]
FROM [OmniDefaults] AS [d]
JOIN [OmniTestPoints] AS [tp]
ON [d].[Id] = [tp].[DefaultId]
JOIN [AlleAuftragPositionen] AS [aap]
ON [d].[IdentNr] = [aap].[IdentNr]
WHERE [aap].[FertigungsauftragNr] = @pono
ORDER BY [tp].[GPM] DESC")
.SetParameter(nameof(pono), pono)
.ExecuteReader(x =>
{
if (inspectionOrder is null)
{
inspectionOrder = new InspectionOrder
{
Id = x.GetValue<short>(0),
Orderno = x.GetValue<int?>(1),
Posno = x.GetValue<short?>(2),
Pono = x.GetValue<int?>(3),
IdentNr = x.GetValue<int>(4),
Name = x.GetValue<string>(5),
Variant = x.GetValue<string>(6),
SizeName = x.GetValue<string>(7),
Size = x.GetValue<byte>(8),
Range = x.GetValue<byte>(9),
Direction = x.GetValue<byte>(10),
IntPart = x.GetValue<byte>(11),
Fraction = x.GetValue<int>(12),
Crf = x.GetValue<short>(13),
Ppr = x.GetValue<byte>(14),
MeterUnits = x.GetValue<byte>(15),
FlowUnits = x.GetValue<byte>(16),
FlowRate = x.GetValue<byte>(17),
PulseWeight = x.GetValue<byte>(18),
PulseWidth = x.GetValue<byte>(19),
PulseUpdate = x.GetValue<byte>(20),
AlarmPercistancePeriodDays = x.GetValue<byte>(21),
DataLogIntervalMinutes = x.GetValue<int>(22),
NumberOfReadingDigits = x.GetValue<short>(23),
OptionalUniDirFields = x.GetValue<int>(24),
ReadingPreset = x.GetValue<string>(25),
DeviceID = x.GetValue<string>(26),
LeakAlarmGPM = x.GetValue<Single>(27),
LeakAlarmTime = x.GetValue<long>(28),
HighFlowAlarmGPM = x.GetValue<Single>(29),
HighFlowAlarmTime = x.GetValue<long>(30),
ReverseFlowAlarmGPM = x.GetValue<Single>(31),
ReverseFlowAlarmTime = x.GetValue<long>(32),
DescriptionL1 = x.GetValue<string>(33),
DescriptionL2 = x.GetValue<string>(34),
DescriptionL3 = x.GetValue<string>(35),
TestClass = x.GetValue<string>(36)
};
}
if (inspectionOrder.TestPoints is null)
{
inspectionOrder.TestPoints = new List<TestPoint>();
}
inspectionOrder.TestPoints.Add(new TestPoint
{
Id = x.GetValue<short>(37),
Nr = x.GetValue<int>(38),
GPM = x.GetValue<Single>(39),
Rotations = x.GetValue<short>(40),
Duration = x.GetValue<short>(41),
MinAcc = x.GetValue<Single>(42),
MaxAcc = x.GetValue<Single>(43),
});
return true;
})
.ToList();
return inspectionOrder;
}
public bool UpdateTestRun(TestedPoint point)
=> this.sql
.CreateCommand($@"
UPDATE [OmniTestRuns]
SET [Q{point.Nr}_TpId] = @{nameof(point.Id)}
, [Q{point.Nr}_Rotations] = @{nameof(point.Rotations)}
, [Q{point.Nr}_Duration] = @{nameof(point.Duration)}
, [Q{point.Nr}_MeterM3S] = @{nameof(point.M3S)}
, [Q{point.Nr}_RefM3S] = @{nameof(point.M3SRef)}
, [Q{point.Nr}_Accuracy] = @{nameof(point.ACC)}
, [Debug] = @{nameof(point.Debug)}
WHERE [Id] = @{nameof(point.RunId)}
AND [BuildInfo] = @{nameof(point.Pcb)}")
.SetParameter(nameof(point.Id), point.Id)
.SetParameter(nameof(point.Rotations), point.Rotations)
.SetParameter(nameof(point.Duration), point.Duration)
.SetParameter(nameof(point.M3S), point.M3S)
.SetParameter(nameof(point.M3SRef), point.M3SRef)
.SetParameter(nameof(point.ACC), point.ACC)
.SetParameter(nameof(point.RunId), point.RunId)
.SetParameter(nameof(point.Pcb), point.Pcb)
.SetParameter(nameof(point.Debug), point.Debug)
.ExecuteNonQuery() == 1;
public bool UpdateTestRun(TestedRun run)
{
var accuracies = new Dictionary<string, Double>();
var length = run.ACC?.Length ?? 0;
for (int i = 0; i < length; i++)
{
accuracies[$"Q{i + 1}_Acc"] = run.ACC[i];
}
var updateTestRunQuery = $@"
UPDATE [OmniTestRuns]
SET [CrrfAfter] = @{nameof(run.CrrF)}
, [Succeeded] = @{nameof(run.Succeeded)}
, [Debug] = @{nameof(run.Debug)}
, [EndDate] = GETDATE()";
foreach (var key in accuracies.Keys)
{
updateTestRunQuery += $@"
, [{key}] = @{key}";
}
updateTestRunQuery += $@"
WHERE [Id] = @{nameof(run.RunId)}
AND [BuildInfo] = @{nameof(run.Pcb)}";
var updateCommand = this.sql
.CreateCommand(updateTestRunQuery)
.SetParameter(nameof(run.RunId), run.RunId)
.SetParameter(nameof(run.Pcb), run.Pcb)
.SetParameter(nameof(run.CrrF), run.CrrF)
.SetParameter(nameof(run.Succeeded), run.Succeeded)
.SetParameter(nameof(run.Debug), run.Debug);
foreach (var kvp in accuracies)
{
updateCommand.SetParameter(kvp.Key, kvp.Value);
}
return updateCommand.ExecuteNonQuery() == 1;
}
}
}
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LaaProduction.Data.Omni")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LaaProduction.Data.Omni")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cb91e680-2715-4e94-988a-401c0f4a0707")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E8FCD0A3-714D-4436-9A20-B098E6A5537D}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>LaaProduction.Console</RootNamespace>
<AssemblyName>LaaProduction.Console</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<NoWarn>IDE0003;IDE0049;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Data.Sqlite, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.9.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_v2, Version=2.1.10.2445, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.bundle_e_sqlite3.2.1.10\lib\net461\SQLitePCLRaw.batteries_v2.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.core, Version=2.1.10.2445, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.core.2.1.10\lib\netstandard2.0\SQLitePCLRaw.core.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.provider.dynamic_cdecl, Version=2.1.10.2445, Culture=neutral, PublicKeyToken=b68184102cba0b3b, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.provider.dynamic_cdecl.2.1.10\lib\netstandard2.0\SQLitePCLRaw.provider.dynamic_cdecl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Data\LaaProduction.Data.Cordonel\LaaProduction.Data.Cordonel.csproj">
<Project>{03784923-1FD3-4535-80F5-286728DF62AB}</Project>
<Name>LaaProduction.Data.Cordonel</Name>
</ProjectReference>
<ProjectReference Include="..\LaaPackages\LaaPackages.HttpClient\LaaPackages.HttpClient.csproj">
<Project>{C9816412-7752-4F7A-8BD2-765DB6D58B3C}</Project>
<Name>LaaPackages.HttpClient</Name>
</ProjectReference>
<ProjectReference Include="..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
<Name>LaaPackages.SqlClient</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del "$(TargetDir)*.pdb"
del "$(TargetDir)*.xml"</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>
</Project>
@@ -1,209 +0,0 @@
namespace LaaProduction.Console
{
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
static Dictionary<string, Dictionary<string, HashSet<Charcode>>> charcodesDictionary = new Dictionary<string, Dictionary<string, HashSet<Charcode>>>();
private static void Main()
{
SetUp();
var actualPatterns = new List<string>();
foreach (var chacodeKVP in charcodesDictionary)
{
var basis = chacodeKVP.Key;
var codesDictionary = chacodeKVP
.Value
.SelectMany(x => x.Value)
.OrderBy(x => x.Stelle)
.ThenBy(x => x.Laenge)
.ThenBy(x => x.Code)
.GroupBy(x => x.Stelle)
.ToDictionary(x => x.Key, x => x.ToList());
var patterns = new List<string> { basis };
foreach (var codeKVP in codesDictionary)
{
var stelle = codeKVP.Key;
var codes = codeKVP.Value;
var tempPatterns = new List<string>();
foreach (var code in codes)
{
foreach (var pattern in patterns)
{
tempPatterns.Add($"{pattern}{new string('_', code.Stelle - 1 - pattern.Length)}{code.Code}");
}
}
patterns.Clear();
patterns.AddRange(tempPatterns);
tempPatterns.Clear();
}
actualPatterns.AddRange(patterns);
}
foreach (var pattern in actualPatterns)
{
Console.WriteLine(pattern);
}
}
static void SetUp()
{
charcodesDictionary["MS"] = new Dictionary<string, HashSet<Charcode>>();
charcodesDictionary["MS"]["Baulänge"] = new HashSet<Charcode>
{
new Charcode { Stelle = 12, Laenge = 1, Code = "E" },
new Charcode { Stelle = 12, Laenge = 1, Code = "F" },
new Charcode { Stelle = 12, Laenge = 1, Code = "D" },
new Charcode { Stelle = 12, Laenge = 1, Code = "H" },
};
charcodesDictionary["MS"]["Nennweite"] = new HashSet<Charcode>
{
new Charcode { Stelle = 5, Laenge = 1, Code = "F" },
new Charcode { Stelle = 5, Laenge = 1, Code = "G" },
new Charcode { Stelle = 5, Laenge = 1, Code = "K" },
new Charcode { Stelle = 5, Laenge = 1, Code = "H" },
new Charcode { Stelle = 5, Laenge = 1, Code = "I" },
};
charcodesDictionary["MS"]["Funkfrequenz"] = new HashSet<Charcode>
{
new Charcode { Stelle = 37, Laenge = 1, Code = "A" },
new Charcode { Stelle = 37, Laenge = 1, Code = "B" },
};
charcodesDictionary["GNS"] = new Dictionary<string, HashSet<Charcode>>();
charcodesDictionary["GNS"]["Baulänge"] = new HashSet<Charcode>
{
new Charcode { Stelle = 14, Laenge = 2, Code = "A1" },
new Charcode { Stelle = 14, Laenge = 2, Code = "A2" },
new Charcode { Stelle = 14, Laenge = 2, Code = "A3" },
new Charcode { Stelle = 14, Laenge = 2, Code = "A5" },
};
charcodesDictionary["GNS"]["NW"] = new HashSet<Charcode>
{
new Charcode { Stelle = 4, Laenge = 2, Code = "FC" },
new Charcode { Stelle = 4, Laenge = 2, Code = "FD" },
new Charcode { Stelle = 4, Laenge = 2, Code = "FE" },
new Charcode { Stelle = 4, Laenge = 2, Code = "FU" },
};
charcodesDictionary["GNS"]["Funkfrequenz"] = new HashSet<Charcode>
{
new Charcode { Stelle = 43, Laenge = 1, Code = "B" },
new Charcode { Stelle = 43, Laenge = 1, Code = "A" },
};
}
}
public class Charcode
{
public string Basis { get; set; }
public string Bezeichnung { get; set; }
public int Stelle { get; set; }
public int Laenge { get; set; }
public string Code { get; set; }
public string Value { get; set; }
public bool Selected { get; set; }
}
}
//public static void _____Main()
//{
// Console.WriteLine(-14 * 24 * 60 * 60);
// //var sentinel = new Sentinel(
// // new HttpConnection("http://10.49.40.25/")
// // , new HttpConnection("localhost")
// // , new CordonelDbContext(
// // new SqlConnection("Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;")));
// //var sentinelDataFile = @"..\..\sentinel-data.json";
// //var result = sentinel.CheckVFMStatus(182100041);
// //Console.WriteLine("=========================================================");
// //foreach (var kvp in result)
// //{
// // Console.WriteLine($"{kvp.Key}: {kvp.Value}");
// //}
// //Console.WriteLine("=========================================================");
// //if (result.Succeeded && result.ContainsKey("UsedData"))
// //{
// // var jsonSerializerSettings = new JsonSerializerSettings
// // {
// // Formatting = Formatting.Indented,
// // TypeNameHandling = TypeNameHandling.Objects | TypeNameHandling.Arrays,
// // TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
// // };
// // var json = JsonConvert.SerializeObject(result["UsedData"], jsonSerializerSettings);
// // File.WriteAllText(sentinelDataFile, json);
// //}
//}
//const string URL_PATTERN = "https://nodes.sms-esaap.com/keygenproxy/api/v2/keys/devices?orderNumber={0}&radioaddress={1}";
//const string X_NODE_TOKEN_HEADER = "X-Node-Token";
//const string X_NODE_TOKEN = "d5b8c0b2-81f6-4421-80d0-44eb2093e616";
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LaaProduction.Console")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LaaProduction.Console")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e8fcd0a3-714d-4436-9a20-b098e6a5537d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net481" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
<package id="Microsoft.Data.Sqlite" version="9.0.0" targetFramework="net481" />
<package id="Microsoft.Data.Sqlite.Core" version="9.0.0" targetFramework="net481" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net481" />
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.1.10" targetFramework="net481" />
<package id="SQLitePCLRaw.core" version="2.1.10" targetFramework="net481" />
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.1.10" targetFramework="net481" />
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.1.10" targetFramework="net481" />
<package id="System.Buffers" version="4.6.0" targetFramework="net481" />
<package id="System.Memory" version="4.6.0" targetFramework="net481" />
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net481" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net481" />
</packages>
@@ -1,8 +0,0 @@
<linker>
<assembly fullname="System.Diagnostics.DiagnosticSource">
<type fullname="System.Diagnostics.Metrics.MetricsEventSource">
<!-- Used by System.Private.CoreLib via reflection to init the EventSource -->
<method name="GetInstance" />
</type>
</assembly>
</linker>
@@ -1,168 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props')" />
<Import Project="..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props" Condition="Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" />
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props')" />
<Import Project="..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{75C5ABF8-3D1C-43A2-961C-BCD54A3DF1CF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaaProduction.Data.Cordonel.UnitTests</RootNamespace>
<AssemblyName>LaaProduction.Data.Cordonel.UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.ApplicationInsights, Version=2.22.0.997, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ApplicationInsights.2.22.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Testing.Extensions.MSBuild, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.MSBuild.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Testing.Extensions.Telemetry, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Testing.Extensions.TrxReport.Abstractions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Testing.Extensions.TrxReport.Abstractions.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.TrxReport.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Testing.Extensions.VSTestBridge, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Testing.Extensions.VSTestBridge.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.VSTestBridge.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Testing.Platform, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Testing.Platform.1.5.0\lib\netstandard2.0\Microsoft.Testing.Platform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.CoreUtilities.dll</HintPath>
</Reference>
<Reference Include="Microsoft.TestPlatform.PlatformAbstractions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.PlatformAbstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.3.7.0\lib\net462\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.3.7.0\lib\net462\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.9.0.0\lib\net462\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.9.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.9.0.0\lib\net462\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Mock\SentinelMockDbContext.cs" />
<Compile Include="Mock\SentinelMockHttpClient.cs" />
<Compile Include="Mock\SentinelTestCase.cs" />
<Compile Include="Mock\SentinelTestContext.cs" />
<Compile Include="Mock\SentinelTestContextExtensions.cs" />
<Compile Include="SentinelTestClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
<None Include="Mock\sentinel-data.json" />
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Data\LaaProduction.Data.Cordonel\LaaProduction.Data.Cordonel.csproj">
<Project>{03784923-1fd3-4535-80f5-286728df62ab}</Project>
<Name>LaaProduction.Data.Cordonel</Name>
</ProjectReference>
<ProjectReference Include="..\LaaPackages\LaaPackages.Features.Cordonel\LaaPackages.Features.Cordonel.csproj">
<Project>{8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}</Project>
<Name>LaaPackages.Features.Cordonel</Name>
</ProjectReference>
<ProjectReference Include="..\LaaPackages\LaaPackages.HttpClient\LaaPackages.HttpClient.csproj">
<Project>{C9816412-7752-4F7A-8BD2-765DB6D58B3C}</Project>
<Name>LaaPackages.HttpClient</Name>
</ProjectReference>
<ProjectReference Include="..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
<Project>{f90b940c-9a83-496d-aae0-11cd02ce0a22}</Project>
<Name>LaaPackages.SqlClient</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\MSTest.Analyzers.3.7.0\analyzers\dotnet\cs\MSTest.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\MSTest.Analyzers.3.7.0\analyzers\dotnet\MSTest.Analyzers.dll" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets')" />
<Import Project="..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets')" />
</Project>
@@ -1,45 +0,0 @@
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
{
using LaaPackages.Features.Cordonel.Models;
using System.Collections.Generic;
public class SentinelMockDbContext : CordonelDbContext
{
private readonly SentinelTestContext sentinelTestContext;
private CordonelAppVeriosnCrc[] appsVersionsCrcs;
private CordonelRegisterHistory[] registerHistory;
private CordonelMetrologyValues metrologyValues;
private CordonelRSSIValues rssiValues;
private CordonelRequirements requirements;
private EOLProgressModel eolProgressModel;
private CordonelProductionData[] productionData;
public SentinelMockDbContext(SentinelTestContext sentinelTestContext) : base(string.Empty, null)
{
this.sentinelTestContext = sentinelTestContext;
this.sentinelTestContext.RegisterHistoryChanged += appsDictionary => this.registerHistory = appsDictionary;
this.sentinelTestContext.AppsVersionsCrcsChanged += appsVersionsCrcs => this.appsVersionsCrcs = appsVersionsCrcs;
this.sentinelTestContext.EOLProgressModelChanged += eolProgressModel => this.eolProgressModel = eolProgressModel;
this.sentinelTestContext.MetroloryValuesChanged += metrologyValues => this.metrologyValues = metrologyValues;
this.sentinelTestContext.ProductionDataChanged += productionData => this.productionData = productionData;
this.sentinelTestContext.RequirementsChanged += requirements => this.requirements = requirements;
this.sentinelTestContext.RSSIValuesChanged += rssiValues => this.rssiValues = rssiValues;
}
internal override EOLProgressModel GetEOLProgressModel(int _) => this.eolProgressModel;
internal override IEnumerable<CordonelAppVeriosnCrc> GetLatestAppsWithVersions(int pcbId, string fwVersion, bool isSpecial) => this.appsVersionsCrcs;
internal override CordonelMetrologyValues GetLatestGenesisFlowValues(object pcbId) => this.metrologyValues;
internal override IEnumerable<CordonelRegisterHistory> GetLatestRegistersWithValues(int pcbId) => this.registerHistory;
internal override CordonelRSSIValues GetLatestRssiValues(string pcbId) => this.rssiValues;
internal override IEnumerable<CordonelProductionData> GetProductionData(int _) => this.productionData;
internal override CordonelRequirements GetRequirements(int pcbId) => this.requirements;
}
}
@@ -1,19 +0,0 @@
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
{
using LaaPackages.Features.Cordonel;
using LaaPackages.HttpClient;
using LaaProduction.Data.Cordonel.Sentinel;
public class SentinelMockHttpClient : SentinelHttpClient
{
private readonly SentinelTestContext testContext;
private CordonelAppsDictionary appsDictionaryDefaults;
public SentinelMockHttpClient(SentinelTestContext testContext)
: base(new HttpConnection("http://localhost"))
{
this.testContext = testContext;
this.testContext.AppsDictionaryDefaultsChanged += appsDictionary => this.appsDictionaryDefaults = appsDictionary;
}
}
}
@@ -1,6 +0,0 @@
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
{
public class SentinelTestCase
{
}
}
@@ -1,120 +0,0 @@
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
{
using LaaPackages.Features.Cordonel;
using LaaPackages.Features.Cordonel.Models;
using LaaProduction.Data.Cordonel.Sentinel;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
public class SentinelTestContext
{
private readonly CordonelAppVeriosnCrc[] appsVersionsCrcs;
private readonly CordonelAppsDictionary appsDictionary;
private readonly CordonelMetrologyValues metrologyValues;
private readonly CordonelRSSIValues rssiValues;
private readonly CordonelRegisterHistory[] registerHistory;
private readonly CordonelRequirements requirements;
private readonly EOLProgressModel eolProgressModel;
private readonly CordonelProductionData productionData;
private readonly CordonelAppsDictionary appsDictionaryDefaults;
public SentinelTestContext(string jsonFile)
{
var data = JsonConvert.DeserializeObject<Dictionary<string, object>>(
value: File.ReadAllText(jsonFile),
settings: new JsonSerializerSettings
{
Formatting = Formatting.Indented,
TypeNameHandling = TypeNameHandling.Objects,
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
});
this.appsVersionsCrcs = data.TryGetValue<CordonelAppVeriosnCrc[]>(nameof(Sentinel.TryGetCordonelAppsAndFWVersionValues));
this.appsDictionary = data.TryGetValue<CordonelAppsDictionary>(nameof(Sentinel.TryGetCordonelAppsAndRegisterValues));
this.metrologyValues = data.TryGetValue<CordonelMetrologyValues>(nameof(Sentinel.TryGetCordonelMetrologyValues));
this.rssiValues = data.TryGetValue<CordonelRSSIValues>(nameof(Sentinel.TryGetCordonelRadioDefaults));
this.registerHistory = data.TryGetValue<CordonelRegisterHistory[]>(nameof(CordonelDbContext.GetLatestRegistersWithValues));
this.requirements = data.TryGetValue<CordonelRequirements>(nameof(Sentinel.TryGetCordonelRequirements));
this.eolProgressModel = data.TryGetValue<EOLProgressModel>(nameof(Sentinel.TryGetEOLProgressModel));
this.productionData = data.TryGetValue<CordonelProductionData>(nameof(Sentinel.TryGetUniqueProductionData));
this.appsDictionaryDefaults = data.TryGetValue<CordonelAppsDictionary>(nameof(CordonelAppsDictionary));
this.Sentinel = new Sentinel(
httpClient: new SentinelMockHttpClient(this),
cordonelDbContext: new SentinelMockDbContext(this));
}
internal event Action<CordonelAppVeriosnCrc[]> AppsVersionsCrcsChanged;
internal event Action<CordonelRegisterHistory[]> RegisterHistoryChanged;
internal event Action<CordonelAppsDictionary> AppsDictionaryDefaultsChanged;
internal event Action<CordonelMetrologyValues> MetroloryValuesChanged;
internal event Action<CordonelRSSIValues> RSSIValuesChanged;
internal event Action<CordonelRequirements> RequirementsChanged;
internal event Action<EOLProgressModel> EOLProgressModelChanged;
internal event Action<CordonelProductionData[]> ProductionDataChanged;
public Sentinel Sentinel { get; }
internal void PrepareNullProductionData() => this.ProductionDataChanged?.Invoke(default(CordonelProductionData[]));
internal void PrepareEmptyProductionData() => this.ProductionDataChanged?.Invoke(new CordonelProductionData[0]);
internal void PrepareMultipleProductionData() => this.ProductionDataChanged?.Invoke(new CordonelProductionData[] { null, null });
internal void PrepareUniqueProductionData() => this.ProductionDataChanged?.Invoke(new CordonelProductionData[] { this.productionData });
internal void PrepareNullEOLProgressModel() => this.EOLProgressModelChanged?.Invoke(null);
internal void PrepareEmptyEOLProgressModel() => this.EOLProgressModelChanged?.Invoke(new EOLProgressModel());
internal void PrepareNullRequirements() => this.RequirementsChanged?.Invoke(null);
internal void PrepareEOLProgressModel() => this.EOLProgressModelChanged?.Invoke(this.eolProgressModel);
internal void PrepareRequiremnets() => this.RequirementsChanged?.Invoke(this.requirements);
internal void PrepareNullRegisterHistory() => this.RegisterHistoryChanged?.Invoke(null);
internal void PrepareEmptyRegisterHistory() => this.RegisterHistoryChanged?.Invoke(new CordonelRegisterHistory[0]);
internal void PrepareRegisterHistory() => this.RegisterHistoryChanged?.Invoke(this.registerHistory);
internal void PrepareNullAppsDictionary() => this.AppsDictionaryDefaultsChanged?.Invoke(null);
internal void PrepareDefaultAppsDictionary() => this.AppsDictionaryDefaultsChanged?.Invoke(this.appsDictionaryDefaults);
internal void PrepareNullAppsVersionsCrcs() => this.AppsVersionsCrcsChanged?.Invoke(null);
internal void PrepareAppsVersionsCrcs() => this.AppsVersionsCrcsChanged?.Invoke(this.appsVersionsCrcs);
internal void PrepareEmptyAppsVersionsCrcs() => this.AppsVersionsCrcsChanged?.Invoke(new CordonelAppVeriosnCrc[0]);
internal void PrepareNullMetrologyValues() => this.MetroloryValuesChanged?.Invoke(null);
internal void PrepareMetrologyValues() => this.MetroloryValuesChanged?.Invoke(this.metrologyValues);
internal void PrepareNullRSSIValues() => this.RSSIValuesChanged?.Invoke(null);
internal void PrepareRSSIValues() => this.RSSIValuesChanged?.Invoke(this.rssiValues);
internal Tuple<EOLProgressModel, CordonelRequirements> TryCompareRequirementsIdAndVersionTestCase(int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8)
=> new Tuple<EOLProgressModel, CordonelRequirements>(
item1: new EOLProgressModel
{
RequirementRequestChecked = EOLStatus.OK,
StandardRequirementId = v1,
StandardRequirementVersion = v2,
SpecialRequirementId = v3,
SpecialRequirementVersion = v4
},
item2: new CordonelRequirements
{
StandardId = v5,
StandardVersion = v6,
SpecialId = v7,
SpecialVersion = v8,
});
}
}
@@ -1,28 +0,0 @@
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
{
using System;
using System.Collections.Generic;
internal static class SentinelTestContextExtensions
{
public static T TryGetValue<T>(this Dictionary<string, object> data, string key)
{
if (string.IsNullOrWhiteSpace(key))
{
throw new InvalidOperationException($"{nameof(key)} ist erforderlich");
}
else if (!data.TryGetValue(key, out var t))
{
throw new InvalidOperationException($"{nameof(key)}: {typeof(T).Name} ist nicht vorhanden");
}
else if (t is T _object)
{
return _object;
}
else
{
throw new InvalidOperationException($"{nameof(key)}: value ist nicht von typ {typeof(T).Name}");
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,20 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("LaaProduction.Data.Cordonel.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LaaProduction.Data.Cordonel.UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("75c5abf8-3d1c-43a2-961c-bcd54a3df1cf")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,415 +0,0 @@
namespace LaaProduction.Data.Cordonel.UnitTests
{
using LaaPackages.Features.Cordonel.Models;
using LaaProduction.Data.Cordonel.Sentinel;
using LaaProduction.Data.Cordonel.UnitTests.Mock;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class SentinelTestClass
{
private readonly SentinelTestContext sentinelTestContext;
private readonly Sentinel sentinel;
private readonly int pcbId;
public SentinelTestClass()
{
var jsonFile = @"..\..\Mock\sentinel-data.json";
this.sentinelTestContext = new SentinelTestContext(jsonFile);
this.sentinel = this.sentinelTestContext.Sentinel;
this.pcbId = 212120036;
}
[TestMethod]
public void TryGetUniqueProductionData_ShouldThrowWhenDataIsNull()
{
// Arrange
this.sentinelTestContext.PrepareNullProductionData();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetUniqueProductionData_ShouldThrowWhenNoData()
{
// Arrange
this.sentinelTestContext.PrepareEmptyProductionData();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetUniqueProductionData_ShouldThrowOnMultipleData()
{
// Arrange
this.sentinelTestContext.PrepareMultipleProductionData();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetUniqueProductionData_ShouldGetUniqueProductionData()
{
// Arrange
this.sentinelTestContext.PrepareUniqueProductionData();
// Act
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var productionData);
// Assert
Assert.IsNotNull(productionData);
}
[TestMethod]
public void TryGetEOLProgressModel_ShouldThrowWhenModelIsNull()
{
// Arrange
this.sentinelTestContext.PrepareNullEOLProgressModel();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetEOLProgressModel(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetEOLProgressModel_ShouldThrowWhenModelDoseNotValidates()
{
// Arrange
this.sentinelTestContext.PrepareEmptyEOLProgressModel();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetEOLProgressModel(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetEOLProgressModel_ShouldGetEOLProgressModel()
{
// Arrange
this.sentinelTestContext.PrepareEOLProgressModel();
// Act
this.sentinel.TryGetEOLProgressModel(this.pcbId, out var eolProgressModel);
// Assert
Assert.IsNotNull(eolProgressModel);
}
[TestMethod]
public void TryGetCordonelRequirements_ShouldThrowWhenRequierementsModelIsNull()
{
// Arrange
this.sentinelTestContext.PrepareNullRequirements();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelRequirements(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetCordonelRequirements_ShouldGetRequirementsModel()
{
// Arrange
this.sentinelTestContext.PrepareRequiremnets();
// Act
this.sentinel.TryGetCordonelRequirements(this.pcbId, out var requirements);
// Assert
Assert.IsNotNull(requirements);
}
[TestMethod]
public void TryGetCordonelAppsAndRegisterValues_ShouldThrowWhenAppsDictionaryIsNull()
{
// Arrange
this.sentinelTestContext.PrepareNullAppsDictionary();
this.sentinelTestContext.PrepareNullRegisterHistory();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetCordonelAppsAndRegisterValues_ShouldThrowWhenRegisterHistoryIsNull()
{
// Arrange
this.sentinelTestContext.PrepareDefaultAppsDictionary();
this.sentinelTestContext.PrepareNullRegisterHistory();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetCordonelAppsAndRegisterValues_ShouldThrowWhenRegisterHistoryIsEmpty()
{
// Arrange
this.sentinelTestContext.PrepareDefaultAppsDictionary();
this.sentinelTestContext.PrepareEmptyRegisterHistory();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var _);
});
}
[TestMethod]
public void TryGetCordonelAppsAndRegisterValues_ShouldGetRegisterHistory()
{
// Arrange
this.sentinelTestContext.PrepareDefaultAppsDictionary();
this.sentinelTestContext.PrepareRegisterHistory();
// Act
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var appsDictionary);
// Assert
Assert.IsNotNull(appsDictionary);
}
[TestMethod]
public void TryGetCordonelAppsAndFWVersionValues_ShouldThrowWhenAppsVersionsIsNull()
{
// Arrange
this.sentinelTestContext.PrepareNullAppsVersionsCrcs();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelAppsAndFWVersionValues(this.pcbId, null, out var _);
});
}
[TestMethod]
public void TryGetCordonelAppsAndFWVersionValues_ShouldThrowWhenAppsVersionsIsEmpty()
{
// Arrange
this.sentinelTestContext.PrepareEmptyAppsVersionsCrcs();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelAppsAndFWVersionValues(this.pcbId, null, out var _);
});
}
[TestMethod]
public void TryGetCordonelAppsAndFWVersionValues_ShouldThrowGetAppsVersionsCrcs()
{
// Arrange
this.sentinelTestContext.PrepareAppsVersionsCrcs();
// Act
this.sentinel.TryGetCordonelAppsAndFWVersionValues(this.pcbId, null, out var appsVersionsCrcs);
// Assert
Assert.IsNotNull(appsVersionsCrcs);
}
[TestMethod]
public void TryGetCordonelMetrologyValues_ShouldThrowWhenMetrologyValuesIsNull()
{
// Arrange
this.sentinelTestContext.PrepareNullMetrologyValues();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelMetrologyValues(this.pcbId, true, out var _);
});
}
[TestMethod]
public void TryGetCordonelMetrologyValues_ShouldGetMetrologyValues()
{
// Arrange
this.sentinelTestContext.PrepareMetrologyValues();
// Act
this.sentinel.TryGetCordonelMetrologyValues(this.pcbId, true, out var metrologyValues);
// Assert
Assert.IsNotNull(metrologyValues);
}
[TestMethod]
public void TryGetCordonelRadioDefaults_ShouldThrowWhenRSSIValuesIsNull()
{
// Arrange
this.sentinelTestContext.PrepareNullRSSIValues();
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryGetCordonelRadioDefaults(this.pcbId, true, out var _);
});
}
[TestMethod]
public void TryGetCordonelRadioDefaults_ShouldGetRSSIValues()
{
// Arrange
this.sentinelTestContext.PrepareRSSIValues();
// Act
this.sentinel.TryGetCordonelRadioDefaults(this.pcbId, true, out var rssiValues);
// Assert
Assert.IsNotNull(rssiValues);
}
[TestMethod]
public void TryCompareRequirementsIdAndVersion_ShouldNotCompareWhenEOLStatusNA()
=> this.sentinel.TryCompareRequirementsIdAndVersion(new EOLProgressModel { RequirementRequestChecked = EOLStatus.NA }, null);
[TestMethod]
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentStandardIds()
{
// Arrange
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 2, 2, 3, 4);
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
});
}
[TestMethod]
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentStandardVersions()
{
// Arrange
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 3, 3, 4);
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
});
}
[TestMethod]
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentSpecialIds()
{
// Arrange
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 2, 4, 4);
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
});
}
[TestMethod]
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentSpecialVersions()
{
// Arrange
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 2, 3, 5);
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
});
}
[TestMethod]
public void TryCompareRequirementsIdAndVersion_ShouldDoNothingWhenIdAndVersionAreSame()
{
// Arrange
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 2, 3, 4);
// Act
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
// Assert OK
}
[TestMethod]
public void TryCompareRegionSizeKey_ShouldDoNothingWhenNA()
{
// Arrange
var eolProgress = new EOLProgressModel { RequirementRegionChecked = EOLStatus.NA };
// Act
this.sentinel.TryCompareRegionSizeKey(null, null, eolProgress);
// Assert
}
[TestMethod]
public void TryCompareRegionSizeKey_ShouldDoNothingWhenRegionSizeKeyAreSame()
{
// Arrange
var eolProgress = new EOLProgressModel { RequirementRegionChecked = EOLStatus.OK };
var productionData = new CordonelProductionData { RegionSizeKey = "AB" };
var requirements = new CordonelRequirements { RegionSizeKey = "AB" };
// Act
this.sentinel.TryCompareRegionSizeKey(productionData, requirements, eolProgress);
// Assert
}
[TestMethod]
public void TryCompareRegionSizeKey_ShouldThrowWhenRegionSizeKeyAreDifferent()
{
// Arrange
var eolProgress = new EOLProgressModel { RequirementRegionChecked = EOLStatus.OK };
var productionData = new CordonelProductionData { RegionSizeKey = "AB" };
var requirements = new CordonelRequirements { RegionSizeKey = "CD" };
// Assert
Assert.ThrowsException<SentinelException>(() =>
{
// Act
this.sentinel.TryCompareRegionSizeKey(productionData, requirements, eolProgress);
});
}
}
}
@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Some files were not shown because too many files have changed in this diff Show More