EOL Progress api example
This commit is contained in:
@@ -33,10 +33,10 @@
|
||||
// 0x6C, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
|
||||
|
||||
// LED on
|
||||
0x1F, 0x01, 0x08,
|
||||
// 0x1F, 0x01, 0x08,
|
||||
|
||||
// Reboot
|
||||
// 0x0E, 0x0,
|
||||
0x0E, 0x00,
|
||||
|
||||
// Provide Pin Auth Level I
|
||||
// 0x43, 0x01, 0x14, 0x30, 0x68, 0xD0,
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
<Window x:Class="Common.UI.WPF.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Common.UI.WPF"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
</Window>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Common.UI.WPF.ViewModels
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
public class MainWindowVM : VM<MainWindowVM>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="Psno" value="2024"/>
|
||||
<add key="SIRT.PortName" value="COM6"/>
|
||||
<add key="SIRT.RWTimeout" value="1000"/>
|
||||
</appSettings>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
{
|
||||
using LaaProduction.Data.Cordonel.ValidationAttributes;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System;
|
||||
|
||||
public class EOLProgressModel
|
||||
@@ -48,24 +50,28 @@
|
||||
/// Requirement could be loaded for this device
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus RequirementRequestChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Requirement PcbId equals PcbId of EOLProgress and Cordonel
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus RequirementPcbIdChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Requirement order equals Cordonel order
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus RequirementOrderChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Requirement region equals Cordonel region
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus RequirementRegionChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -99,6 +105,7 @@
|
||||
/// Battery load is in required range
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus ProductionStatusBatteryLoadChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -111,42 +118,49 @@
|
||||
/// Remaining life time is in required range
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus ProductionStatusRemainingLifeTimeChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Zero flow process executed and parameter set
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus ProductionStatusZeroFlowChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Calibration process executed and parameter set
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus ProductionStatusCalibrationChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Final configuration written with Vako, CSD ... parameters.
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus ParametrizationDoneChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Parameters saved to non volatile memory.
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus StoreConfigurationDoneChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reboot executed to clear RAM values and reload values from flash to RAM for check.
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus RebootDoneChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Final configuration - read back and compared.
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus ParametrizationCompareChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -165,18 +179,21 @@
|
||||
/// Final radio system state is as required
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus FinalRadioSystemStateCheck { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Password file generated and installed.
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus PasswordFileInstalledCheck { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attachments like pulse adapter checked.
|
||||
/// </summary>
|
||||
[NotFailed]
|
||||
[JsonConverter(typeof(JsonStatusConverter))]
|
||||
public EOLStatus AttachmentsChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
+40
-40
@@ -91,17 +91,17 @@
|
||||
ParametrizationDoneChecked = reader.GetValue<String>(20),
|
||||
StoreConfigurationDoneChecked = reader.GetValue<String>(21),
|
||||
RebootDoneChecked = reader.GetValue<String>(22),
|
||||
ParametrizationCompareChecked = reader.GetValue<String>(21),
|
||||
RadioCheckId = reader.GetValue<Int64?>(23),
|
||||
FinalRadioSystemState = reader.GetValue<Int64?>(24),
|
||||
FinalRadioSystemStateCheck = reader.GetValue<String>(25),
|
||||
PasswordFileInstalledCheck = reader.GetValue<String>(26),
|
||||
AttachmentsChecked = reader.GetValue<String>(27),
|
||||
EOLCompleteDate = reader.GetValue<DateTime?>(28),
|
||||
EOLSoftwareNameAndVersion = reader.GetValue<String>(29),
|
||||
SAPExportDone = reader.GetValue<String>(30),
|
||||
SentinelCompleted = reader.GetValue<String>(31),
|
||||
SentinelCompletedDate = reader.GetValue<DateTime?>(32),
|
||||
ParametrizationCompareChecked = reader.GetValue<String>(23),
|
||||
RadioCheckId = reader.GetValue<Int64?>(24),
|
||||
FinalRadioSystemState = reader.GetValue<Int64?>(25),
|
||||
FinalRadioSystemStateCheck = reader.GetValue<String>(26),
|
||||
PasswordFileInstalledCheck = reader.GetValue<String>(27),
|
||||
AttachmentsChecked = reader.GetValue<String>(28),
|
||||
EOLCompleteDate = reader.GetValue<DateTime?>(29),
|
||||
EOLSoftwareNameAndVersion = reader.GetValue<String>(30),
|
||||
SAPExportDone = reader.GetValue<String>(31),
|
||||
SentinelCompleted = reader.GetValue<String>(32),
|
||||
SentinelCompletedDate = reader.GetValue<DateTime?>(33),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,34 +110,34 @@
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_EOL_Progress
|
||||
SET StandardRequirementId = ISNULL(StandardRequirementId, @{nameof(model.StandardRequirementId)})
|
||||
, StandardRequirementVersion = ISNULL(StandardRequirementVersion, @{nameof(model.StandardRequirementVersion)})
|
||||
, SpecialRequirementId = ISNULL(SpecialRequirementId, @{nameof(model.SpecialRequirementId)})
|
||||
, SpecialRequirementVersion = ISNULL(SpecialRequirementVersion, @{nameof(model.SpecialRequirementVersion)})
|
||||
, RequirementRequestChecked = ISNULL(RequirementRequestChecked, @{nameof(model.RequirementRequestChecked)})
|
||||
, RequirementPcbIdChecked = ISNULL(RequirementPcbIdChecked, @{nameof(model.RequirementPcbIdChecked)})
|
||||
, RequirementOrderChecked = ISNULL(RequirementOrderChecked, @{nameof(model.RequirementOrderChecked)})
|
||||
, RequirementRegionChecked = ISNULL(RequirementRegionChecked, @{nameof(model.RequirementRegionChecked)})
|
||||
, ProductionStatusLutCrc = ISNULL(ProductionStatusLutCrc, @{nameof(model.ProductionStatusLutCrc)})
|
||||
, ProductionStatusFwVersion = ISNULL(ProductionStatusFwVersion, @{nameof(model.ProductionStatusFwVersion)})
|
||||
, ProductionStatusMeterSize = ISNULL(ProductionStatusMeterSize, @{nameof(model.ProductionStatusMeterSize)})
|
||||
, ProductionStatusDrainedBatteryLoad = ISNULL(ProductionStatusDrainedBatteryLoad, @{nameof(model.ProductionStatusDrainedBatteryLoad)})
|
||||
, ProductionStatusBatteryLoadChecked = ISNULL(ProductionStatusBatteryLoadChecked, @{nameof(model.ProductionStatusBatteryLoadChecked)})
|
||||
, ProductionStatusRemainingLifeTime = ISNULL(ProductionStatusRemainingLifeTime, @{nameof(model.ProductionStatusRemainingLifeTime)})
|
||||
, ProductionStatusRemainingLifeTimeChecked = ISNULL(ProductionStatusRemainingLifeTimeChecked, @{nameof(model.ProductionStatusRemainingLifeTimeChecked)})
|
||||
, ProductionStatusZeroFlowChecked = ISNULL(ProductionStatusZeroFlowChecked, @{nameof(model.ProductionStatusZeroFlowChecked)})
|
||||
, ProductionStatusCalibrationChecked = ISNULL(ProductionStatusCalibrationChecked, @{nameof(model.ProductionStatusCalibrationChecked)})
|
||||
, ParametrizationDoneChecked = ISNULL(ParametrizationDoneChecked, @{nameof(model.ParametrizationDoneChecked)})
|
||||
, StoreConfigurationDoneChecked = ISNULL(StoreConfigurationDoneChecked, @{nameof(model.StoreConfigurationDoneChecked)})
|
||||
, RebootDoneChecked = ISNULL(RebootDoneChecked, @{nameof(model.RebootDoneChecked)})
|
||||
, ParametrizationCompareChecked = ISNULL(ParametrizationCompareChecked, @{nameof(model.ParametrizationCompareChecked)})
|
||||
, RadioCheckId = ISNULL(RadioCheckId, @{nameof(model.RadioCheckId)})
|
||||
, FinalRadioSystemState = ISNULL(FinalRadioSystemState, @{nameof(model.FinalRadioSystemState)})
|
||||
, FinalRadioSystemStateCheck = ISNULL(FinalRadioSystemStateCheck, @{nameof(model.FinalRadioSystemStateCheck)})
|
||||
, PasswordFileInstalledCheck = ISNULL(PasswordFileInstalledCheck, @{nameof(model.PasswordFileInstalledCheck)})
|
||||
, AttachmentsChecked = ISNULL(AttachmentsChecked, @{nameof(model.AttachmentsChecked)})
|
||||
, EOLCompleteDate = ISNULL(EOLCompleteDate, @{nameof(model.EOLCompleteDate)})
|
||||
, EOLSoftwareNameAndVersion = ISNULL(EOLSoftwareNameAndVersion, @{nameof(model.EOLSoftwareNameAndVersion)})
|
||||
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)}
|
||||
, 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)
|
||||
@@ -208,7 +208,7 @@
|
||||
SET SAPExportDone = 'OK'
|
||||
, SentinelCompleted = 'OK'
|
||||
, SentinelCompletedDate = GETDATE()
|
||||
WHERE PcbId = @{nameof(model.PcbId)}")
|
||||
WHERE PcbId = @{nameof(model.PcbId)}")
|
||||
.SetParameter(nameof(model.PcbId), model.PcbId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
<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.Core" />
|
||||
<Reference Include="System.IO, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
@@ -77,6 +80,10 @@
|
||||
<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="..\LaaProduction.Data.SQL\LaaProduction.Data.SQL.csproj">
|
||||
<Project>{82D34580-23FE-4315-BC51-51D565ABAE23}</Project>
|
||||
<Name>LaaProduction.Data.SQL</Name>
|
||||
|
||||
@@ -1,61 +1,51 @@
|
||||
namespace LaaProduction.Console
|
||||
{
|
||||
using LaaProduction.Data.Cordonel.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(String[] args)
|
||||
{
|
||||
GetKitronProductionDate();
|
||||
}
|
||||
|
||||
private static DateTime GetKitronProductionDate()
|
||||
{
|
||||
var requestURIBuilder = new UriBuilder("http://10.49.40.25");
|
||||
requestURIBuilder.Path = "/MeterProcessState/api/FinalCheck/GetKitronProductionDate";
|
||||
requestURIBuilder.Query = $"CheckPcbId=241610009";
|
||||
|
||||
using (var httpClient = new HttpClient())
|
||||
while (true)
|
||||
{
|
||||
using (var httpRequestMessage = new HttpRequestMessage())
|
||||
{
|
||||
httpRequestMessage.Method = HttpMethod.Get;
|
||||
httpRequestMessage.RequestUri = requestURIBuilder.Uri;
|
||||
var pcbId = 212120036;
|
||||
var httpclient = new HttpClient();
|
||||
httpclient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
|
||||
using (var httpResponseMessage = httpClient.SendAsync(httpRequestMessage).Result)
|
||||
{
|
||||
var content = httpResponseMessage.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
}
|
||||
var deleted = httpclient
|
||||
.DeleteAsync($"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/eolprogress/{pcbId}")
|
||||
.Result;
|
||||
var deletedContent = deleted.Content.ReadAsStringAsync().Result;
|
||||
var deletedModel = JsonConvert.DeserializeObject<EOLProgressModel>(deletedContent);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
|
||||
var created = httpclient
|
||||
.GetAsync($"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/eolprogress/{pcbId}")
|
||||
.Result;
|
||||
var createdContent = created.Content.ReadAsStringAsync().Result;
|
||||
var createdModel = JsonConvert.DeserializeObject<EOLProgressModel>(createdContent);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
|
||||
createdModel.AttachmentsChecked = EOLStatus.OK;
|
||||
createdModel.EOLSoftwareNameAndVersion = "a";
|
||||
|
||||
var postedJson = JsonConvert.SerializeObject(createdModel, Formatting.Indented);
|
||||
var postedBody = new StringContent(postedJson);
|
||||
postedBody.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json");
|
||||
var posted = httpclient
|
||||
.PostAsync($"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/eolprogress", postedBody)
|
||||
.Result;
|
||||
|
||||
var postedContent = posted.Content.ReadAsStringAsync().Result;
|
||||
var postedModel = JsonConvert.DeserializeObject<EOLProgressModel>(postedContent);
|
||||
}
|
||||
|
||||
return DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////// 0. Unseal If Sealed
|
||||
////////////// 1. View System Parameters
|
||||
////////////// 2. Verify System Parameters
|
||||
////////////// 3. View & Save Configuration Parameters
|
||||
/// 4. Reboot Register
|
||||
/// 5. Set Register Settings
|
||||
/// 6. Set Configuration Parameters
|
||||
/// 7. Remove Reading Unit & Resolution
|
||||
/// 8. Set Leak Alarm
|
||||
/// 9. Set High Flow Alarm
|
||||
/// 10. Set Reverse Flow Alarm
|
||||
/// 11. Clear Metrology Alarms
|
||||
/// 12. Enable NFC
|
||||
/// 13. Verify Register Settings
|
||||
/// 14. Verify System Parameters
|
||||
/// 15. Verify Configuration Parameters
|
||||
/// 16. View Alarms State
|
||||
/// 17. Verify Leak Alarm
|
||||
/// 18. Verify High Flow Alarm
|
||||
/// 19. Verify Reverse Flow Alarm
|
||||
/// 20. Seal Register
|
||||
@@ -3,4 +3,5 @@
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net40" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net40" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net40" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -62,8 +62,13 @@
|
||||
|
||||
[HttpPost]
|
||||
[Route]
|
||||
public IHttpActionResult Post([FromBody] EOLProgressModel model)
|
||||
public IHttpActionResult Post(EOLProgressModel model)
|
||||
{
|
||||
if (model is null)
|
||||
{
|
||||
return this.BadRequest("The EOLProgressModel should not be null.");
|
||||
}
|
||||
|
||||
var actualEOLProgressModel = this.dbcontext.EOLProgress.Update(model);
|
||||
|
||||
return this.Json(actualEOLProgressModel);
|
||||
|
||||
Reference in New Issue
Block a user