GenesisStatus from DB template
This commit is contained in:
@@ -15,11 +15,37 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus
|
||||
/// </summary>
|
||||
public class GenesisStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Data base primary key
|
||||
/// </summary>
|
||||
public Int32 Id;
|
||||
|
||||
/// <summary>
|
||||
/// Order number
|
||||
/// </summary>
|
||||
public Int32 OrderNumber;
|
||||
|
||||
/// <summary>
|
||||
/// PcbId.
|
||||
/// </summary>
|
||||
public String PcbId;
|
||||
|
||||
/// <summary>
|
||||
/// Skip radio parameter check
|
||||
/// </summary>
|
||||
public Boolean SkipRadioParametersCheck;
|
||||
|
||||
/// <summary>
|
||||
/// Skip FW check. Normally the FW will be assigned to the latest released version
|
||||
/// and taken from the data base. Here special versions can be used for FW tests.
|
||||
/// </summary>
|
||||
public Boolean SkipFwCheck;
|
||||
|
||||
/// <summary>
|
||||
/// Skip the look-up-table installation as this device may be used for development.
|
||||
/// </summary>
|
||||
public Boolean SkipLutCheck;
|
||||
|
||||
/// <summary>
|
||||
/// Internally used to signal that production and shipping is proved and validated.
|
||||
/// </summary>
|
||||
@@ -60,6 +86,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus
|
||||
/// </summary>
|
||||
public Double DrainedBatteryLoadPercent;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum drained Battery load in percent.
|
||||
/// </summary>
|
||||
public Double MaxDrainedBatteryLoadPercent;
|
||||
|
||||
/// <summary>
|
||||
/// Number of batteries attached to Cordonel.
|
||||
/// </summary>
|
||||
@@ -90,20 +121,5 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus
|
||||
/// Date of approval.
|
||||
/// </summary>
|
||||
public DateTime ApprovalDate;
|
||||
|
||||
/// <summary>
|
||||
/// Battery drainage is extended by approval.
|
||||
/// </summary>
|
||||
public Boolean BatteryDrainageExtended;
|
||||
|
||||
/// <summary>
|
||||
/// Remaining life time is reduced by approval.
|
||||
/// </summary>
|
||||
public Boolean RemainingLifeTimeReduced;
|
||||
|
||||
/// <summary>
|
||||
/// Date until Cordonel has to be produced is extended by approval.
|
||||
/// </summary>
|
||||
public Boolean ProductionDueDateExtended;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -45,6 +48,14 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\CommonCore.Configuration\CommonCore.Configuration.csproj">
|
||||
<Project>{9EB1F659-6F73-4F65-BCAB-4114FD94F5FC}</Project>
|
||||
<Name>CommonCore.Configuration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
||||
<Project>{A33E3C6D-EAAE-4A20-A0EE-F9E6922FD029}</Project>
|
||||
<Name>SoftwareAccessHelper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\GenesisCore\GenesisCore.csproj">
|
||||
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
||||
<Name>GenesisCore</Name>
|
||||
@@ -54,5 +65,8 @@
|
||||
<Name>Registers</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
+42
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus
|
||||
{
|
||||
@@ -12,6 +15,45 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus
|
||||
/// </summary>
|
||||
public static class GenesisStatusHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all production infos for skip process checks or limits for production like:
|
||||
/// - Battery drained percentage upper limit,
|
||||
/// - Production due date for a special register,
|
||||
/// - Required life time for assembly line,
|
||||
/// - Required life time for shipping line.
|
||||
/// </summary>
|
||||
/// <param name="pcbId"></param>
|
||||
/// <param name="orderNumber"></param>
|
||||
/// <param name="status">production status</param>
|
||||
/// <returns>true if successfully executed</returns>
|
||||
/// <remarks date="2023-Mar-02" author="Roland Drabesch/Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public static Boolean GetProductionSkipAndLifeTimeInfoFromDb(String pcbId, Int32 orderNumber,
|
||||
out GenesisStatus status)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pcbId))
|
||||
{
|
||||
status = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var url = ServiceUrls.GetProductionSkipAndLifeTimeInfoServiceUrl();
|
||||
url += $"{pcbId}&orderNumber={orderNumber}";
|
||||
var response = LocalWebRequest.GetRequest(url, 2000);
|
||||
status = JsonConvert.DeserializeObject<GenesisStatus>(response);
|
||||
}
|
||||
catch (Exception )
|
||||
{
|
||||
status = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read and calculate life time information.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user