GenesisStatus from DB template
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Property/@EntryIndexedValue"><Policy Inspect="False" Prefix="" Suffix="" Style="Aa_bb" /></s:String>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="D:\Projekte\SENSUS_tfs_workspaces\WorkBenchV2\Main\Common\Ui\IrdaFunctionalTestApp\bin\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.dll" />
|
||||
<Assembly Path="D:\Projekte\SENSUS_GitLab\laa_production\Common\Hardware\WaterMeter\Genesis\GenesisPwd\bin\Debug\Newtonsoft.Json.dll" />
|
||||
</AssemblyExplorer></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/ExcludedFiles/FilesAndFoldersToSkip/=1057AD21_002DBA22_002D4CAB_002DB3FE_002D88C5C9980E6A_002Fd_003AScripts_002Ff_003Ajquery_002D1_002E10_002E2_002Eintellisense_002Ejs/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/SolBuilderDuo/UseMsbuildSolutionBuilder/@EntryValue">NewVersion</s:String>
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace Xylem.Common.CommonCore.Configuration
|
||||
private const String DefaultSetCordonelAppVersionServiceUrl =
|
||||
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/ProccesState/SetCordonelProgress?PcbId=";
|
||||
|
||||
private const String DefaultGetProductionSkipAndLifeTimeInfoUrl =
|
||||
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/ProccesState/GetProductionSkipAndLifeTimeInfo?PcbId=";
|
||||
|
||||
private const String DefaultGetCordonelAppVersionServiceUrl =
|
||||
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/ProccesState/GetCordonelAppVersion?PcbId=";
|
||||
|
||||
@@ -305,6 +308,20 @@ namespace Xylem.Common.CommonCore.Configuration
|
||||
DefaultSetCordonelAppVersionServiceUrl;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// <returns></returns>
|
||||
public static String GetProductionSkipAndLifeTimeInfoServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GetProductionSkipAndLifeTimeInfoUrl"] ??
|
||||
DefaultGetProductionSkipAndLifeTimeInfoUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all applications versions installed to a specific Cordonel.
|
||||
/// </summary>
|
||||
|
||||
@@ -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>
|
||||
@@ -8,6 +8,7 @@ using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.ProcessState;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
@@ -690,7 +691,7 @@ namespace Service.MeterProcessState.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[Route("GetCordonelSkipProcessStates")]
|
||||
[Route("GetCordonelSkipProcessStates")]
|
||||
public async Task<HttpResponseMessage> GetCordonelSkipProcessStates(Int32 PcbId, Int32 OrderNumber)
|
||||
{
|
||||
try
|
||||
@@ -701,7 +702,6 @@ namespace Service.MeterProcessState.Controllers
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
||||
sb.AppendLine($" select [id] ");
|
||||
sb.AppendLine($" ,[OrderNumber] ");
|
||||
sb.AppendLine($" ,[PcbId] ");
|
||||
@@ -759,6 +759,100 @@ namespace Service.MeterProcessState.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[Route("GetProductionSkipAndLifeTimeInfo")]
|
||||
public async Task<HttpResponseMessage> GetProductionSkipAndLifeTimeInfo(Int32 pcbId, Int32 orderNumber)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() =>
|
||||
{
|
||||
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//TODO Roland Design new Table
|
||||
sb.AppendLine($" select [id] ");
|
||||
sb.AppendLine($" ,[OrderNumber] ");
|
||||
sb.AppendLine($" ,[PcbId] ");
|
||||
sb.AppendLine($" ,[SkipRadioParametersCheck] ");
|
||||
sb.AppendLine($" ,[SkipFwCheck] ");
|
||||
sb.AppendLine($" ,[SkipLutCheck] ");
|
||||
sb.AppendLine($" ,[RequiredLifeTimeYearsAssembly] ");
|
||||
sb.AppendLine($" ,[RequiredLifeTimeYearsShipping] ");
|
||||
sb.AppendLine($" ,[KitronProductionDate] ");
|
||||
sb.AppendLine($" ,[MaxDrainedBatteryLoadPercent] ");
|
||||
sb.AppendLine($" ,[MaxStorageMonths] ");
|
||||
sb.AppendLine($" ,[ApprovalDate] ");
|
||||
sb.AppendLine($" ,[ApproverName] ");
|
||||
sb.AppendLine($" ,[ApprovalComment] ");
|
||||
sb.AppendLine($" FROM [Auftrag].[dbo].[ProductionSkipAndLifeTimeInfo] ");
|
||||
sb.AppendLine($" where ");
|
||||
sb.AppendLine($" (OrderNumber = {orderNumber} or OrderNumber is null) ");
|
||||
sb.AppendLine($" and (PcbId = {pcbId} or PcbId is null) ");
|
||||
|
||||
//TODO Roland: The defaults should come from a DefaultProductionSkipAndLifeTimeInfo table
|
||||
const Int32 DefaultMaxMonthsNaRegion = 6;
|
||||
const Int32 DefaultMaxMonthsEmeaRegion = 3;
|
||||
const Double DefaultRequiredLifeTimeYearsAssembly = 21.0;
|
||||
const Double DefaultRequiredLifeTimeYearsShipping = 20.0;
|
||||
const Double DefaultMaxDrainedBatteryLoadPercent = 10.0;
|
||||
|
||||
var dt = dataAccess.ExecuteQuery(sb.ToString());
|
||||
if (dt.Rows.Count != 1 )
|
||||
{
|
||||
var stat = new GenesisStatus
|
||||
{
|
||||
SkipFwCheck = false,
|
||||
SkipLutCheck = false,
|
||||
SkipRadioParametersCheck = false,
|
||||
RequiredLifeTimeYearsAssembly = DefaultRequiredLifeTimeYearsAssembly,
|
||||
RequiredLifeTimeYearsShipping = DefaultRequiredLifeTimeYearsShipping,
|
||||
MaxDrainedBatteryLoadPercent = DefaultMaxDrainedBatteryLoadPercent,
|
||||
};
|
||||
//TODO Roland implement defaults
|
||||
// get region from order if (Region == "NA")
|
||||
stat.ProductionDueDate = stat.KitronProductionDate + TimeSpan.FromDays(30.0 * DefaultMaxMonthsNaRegion);
|
||||
// else
|
||||
stat.ProductionDueDate = stat.KitronProductionDate + TimeSpan.FromDays(30.0 * DefaultMaxMonthsEmeaRegion);
|
||||
return stat;
|
||||
}
|
||||
var ret = new GenesisStatus();
|
||||
foreach (var item in dt.Select())
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
ret.OrderNumber = orderNumber;
|
||||
ret.PcbId = pcbId.ToString();
|
||||
ret.SkipRadioParametersCheck = (Boolean)item["SkipRadioParametersCheck"];
|
||||
ret.SkipFwCheck = (Boolean)item["SkipFWCheck"];
|
||||
ret.SkipLutCheck = (Boolean)item["SkipLutCheck"];
|
||||
ret.RequiredLifeTimeYearsAssembly = (Double)item["RequiredLifeTimeYearsAssembly"];
|
||||
ret.RequiredLifeTimeYearsShipping = (Double)item["RequiredLifeTimeYearsShipping"];
|
||||
ret.MaxDrainedBatteryLoadPercent = (Double)item["MaxDrainedBatteryLoadPercent"];
|
||||
ret.KitronProductionDate = (DateTime)item["KitronProductionDate"];
|
||||
var maxStorageMonths = (Int32)item["MaxStorageMonths"];
|
||||
ret.ProductionDueDate = ret.KitronProductionDate + TimeSpan.FromDays(30.0 * maxStorageMonths);
|
||||
ret.ApprovalDate = (DateTime)item["ApprovalDate"];
|
||||
ret.ApproverName = item["ApproverName"].ToString();
|
||||
ret.ApprovalComment = item["ApprovalComment"].ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex.ToString() + "<br >" + ex.InnerException.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -385,6 +385,10 @@
|
||||
<Project>{2C6378C6-6BA1-4CEE-8992-8404D8369A90}</Project>
|
||||
<Name>GenesisFile</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Hardware\WaterMeter\Genesis\GenesisStatus\GenesisStatus\GenesisStatus.csproj">
|
||||
<Project>{0F646872-D8DC-4EE5-989F-D4C73F0ACE3F}</Project>
|
||||
<Name>GenesisStatus</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Hardware\WaterMeter\WaterMeterCore\WaterMeterCore.csproj">
|
||||
<Project>{8203ABB8-38E5-472E-A742-33F38B7A74A6}</Project>
|
||||
<Name>WaterMeterCore</Name>
|
||||
|
||||
Reference in New Issue
Block a user