to long no commit

This commit is contained in:
Roland Drabesch
2022-05-10 15:34:48 +02:00
parent 4c758809ad
commit 8c5dfba956
25 changed files with 1955 additions and 56 deletions
@@ -316,11 +316,10 @@ namespace CordonelAssemblyLine.Model
// return false; // return false;
//} //}
meter.WriteRegister("METROLOGYASST_PressurePresent", 0, true);
var PressureReadOut = RegisterConverter.ConvertTo<bool>(meter.ReadRegister("METROLOGYASST_PressurePresent")); var PressureReadOut = RegisterConverter.ConvertTo<bool>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
if (!PressureReadOut) if (PressureReadOut)
{ {
meter.WriteRegister("METROLOGYASST_PressurePresent", 1, true);
meter.WriteRegister("METROLOGYASST_PressureMeasure", 1, true); meter.WriteRegister("METROLOGYASST_PressureMeasure", 1, true);
@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid> <ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace> <RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName> <AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
@@ -99,6 +99,9 @@
<PropertyGroup /> <PropertyGroup />
<PropertyGroup /> <PropertyGroup />
<PropertyGroup /> <PropertyGroup />
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <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> <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
@@ -2132,7 +2132,17 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </remarks> /// </remarks>
public Boolean StoreAllConfigurations() public Boolean StoreAllConfigurations()
{ {
var overallResult = true;
var allConfigRegisters = _configRegister.MeterRegisterDic.Count(a =>
a.Key.RegisterName.ToLower() == "storeconfiguration" ||
a.Key.RegisterName.ToLower() == "storecalibration");
if (allConfigRegisters < 8)
{
return false;
}
foreach (var a in _configRegister.MeterRegisterDic.Where(a => foreach (var a in _configRegister.MeterRegisterDic.Where(a =>
a.Key.RegisterName.ToLower() == "storeconfiguration" || a.Key.RegisterName.ToLower() == "storeconfiguration" ||
a.Key.RegisterName.ToLower() == "storecalibration")) a.Key.RegisterName.ToLower() == "storecalibration"))
@@ -2150,7 +2160,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
retryLeft -= 1; retryLeft -= 1;
if (retryLeft == 0) if (retryLeft == 0)
{ {
overallResult = false; return false;
} }
continue; continue;
@@ -2160,6 +2170,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
if (a.Key.AppName == "SENSUSRADIO") if (a.Key.AppName == "SENSUSRADIO")
{ {
done = true; done = true;
allConfigRegisters = allConfigRegisters - 1;
continue; continue;
} }
@@ -2169,17 +2180,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
retryLeft -= 1; retryLeft -= 1;
if (retryLeft == 0) if (retryLeft == 0)
{ {
overallResult = false; return false;
} }
continue; continue;
} }
done = true; done = true;
allConfigRegisters = allConfigRegisters - 1;
} }
} }
return overallResult; return allConfigRegisters == 0;
} }
@@ -24,6 +24,11 @@ namespace Logic.ProductionToProductMapper.Cordonel
public Dictionary<UInt32, UInt32> CheckAppsIdVersion { get; private set; } public Dictionary<UInt32, UInt32> CheckAppsIdVersion { get; private set; }
public int StrLutFileId { get; private set; }
public UInt16 Version { get; private set; }
public UInt16 FileCrc { get; private set; }
//order overview //order overview
public UInt32 OrderCount { get; private set; } public UInt32 OrderCount { get; private set; }
public UInt32 OrderAssignedCount { get; private set; } public UInt32 OrderAssignedCount { get; private set; }
@@ -0,0 +1,22 @@
using Logic.ProductionToProductMapper.Cordonel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Logic.ProductionToProductMapper.Files.Lut
{
public class CordonelMetrologyLut
{
public int FileId { get; set; }
public string FileName { get; set; }
public MeterSize MeterSize { get; set; }
public string Region { get; set; }
public int CRC { get; set; }
public bool ForProduction { get; set; }
public List<byte> Content { get; set; }
}
}
@@ -80,6 +80,7 @@
<Compile Include="Cordonel\RegisterHisory.cs" /> <Compile Include="Cordonel\RegisterHisory.cs" />
<Compile Include="Files\Fw\ClusteredFile.cs" /> <Compile Include="Files\Fw\ClusteredFile.cs" />
<Compile Include="Files\Fw\FilePart.cs" /> <Compile Include="Files\Fw\FilePart.cs" />
<Compile Include="Files\Lut\CordonelMetrologyLut.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -96,5 +97,6 @@
<Name>ProductionOrderCore</Name> <Name>ProductionOrderCore</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
@@ -67,8 +67,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{ {
try try
{ {
var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={base.Meter.PcbId}"; //var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={base.Meter.PcbId}";
//var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={base.Meter.PcbId}"; var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={base.Meter.PcbId}";
var csdRet = LocalWebRequest.GetRequest(url, 80000); var csdRet = LocalWebRequest.GetRequest(url, 80000);
return Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet); return Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
@@ -114,17 +114,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay", overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true)); (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressurePresent",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressurePresent",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
foreach (var item in myJsonResponse.Where(m => m.Source == ProgrammingSource.Vako)) foreach (var item in myJsonResponse.Where(m => m.Source == ProgrammingSource.Vako))
{ {
if (!item.RegisterName.Contains("GENESISFLOW_DisplayPow10") if (!item.RegisterName.Contains("GENESISFLOW_DisplayPow10")
&& !item.RegisterName.ToLower().Contains("apparrangement") && !item.RegisterName.ToLower().Contains("apparrangement")
&& !item.RegisterName.ToLower().Contains("SENSUSRADIO_RadioAddress")
) )
{ {
@@ -135,10 +129,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{ {
} }
if (item.RegisterName.Contains("SENSUSRADIO_RadioAddress"))
{
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
}
if (item.RegisterName.Contains("GENESISFLOW_DisplayPow10")) if (item.RegisterName.Contains("GENESISFLOW_DisplayPow10"))
{ {
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, 253, true, true)); overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, 253, true, true));
@@ -150,7 +141,6 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{ {
if (!item.RegisterName.Contains("GENESISFLOW_DisplayPow10") if (!item.RegisterName.Contains("GENESISFLOW_DisplayPow10")
&& !item.RegisterName.ToLower().Contains("apparrangement") && !item.RegisterName.ToLower().Contains("apparrangement")
&& !item.RegisterName.ToLower().Contains("SENSUSRADIO_RadioAddress")
&& !item.RegisterName.ToLower().Contains("SENSUSRADIO_EncryptionKey") && !item.RegisterName.ToLower().Contains("SENSUSRADIO_EncryptionKey")
) )
@@ -168,14 +158,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{ {
} }
if (item.RegisterName.Contains("SENSUSRADIO_RadioAddress"))
{
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
}
if (item.RegisterName.Contains("SENSUSRADIO_RadioAddress"))
{
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
}
if (item.RegisterName.Contains("GENESISFLOW_DisplayPow10")) if (item.RegisterName.Contains("GENESISFLOW_DisplayPow10"))
{ {
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, 253, true, true)); overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, 253, true, true));
@@ -208,16 +191,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmBroadcastMask", new byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false)); overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmBroadcastMask", new byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmVisualMask", new byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false)); overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmVisualMask", new byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false));
var funkadresse = new List<byte>();
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
funkadresse.AddRange((new Byte[] { 0xAC, 0x21, 0x65, 0x35 }).ToArray());
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay", overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true)); (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
@@ -12,7 +12,9 @@ using System.Threading.Tasks;
using System.Web; using System.Web;
using System.Web.Http; using System.Web.Http;
using Xylem.Common.Cryptology.Security; using Xylem.Common.Cryptology.Security;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.ServiceFwUpdate.Common.FwUpdateDb; using Xylem.ServiceFwUpdate.Common.FwUpdateDb;
using Xylem.ServiceFwUpdate.Common.FwUpdateSafe;
using Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery; using Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery;
namespace Xylem.Common.Service.MeterProcessState.Controllers namespace Xylem.Common.Service.MeterProcessState.Controllers
@@ -707,25 +709,133 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
} }
[Route("GetFakeRecoveryFile"), HttpGet] [Route("GetRecoveryFile"), HttpGet]
public async Task<HttpResponseMessage> GetFakeRecoveryFile(int PcbID, int? RadioFrq, string Region, string FlexnetVersion) public async Task<HttpResponseMessage> GetRecoveryFile(int PcbID, int? RadioFrq, string Region, string FlexnetVersion)
{ {
var file = new RecoverySettings() { PrecondidtionCheckPcbID = PcbID, PrecondidtionCheckRadioFrq = RadioFrq , PrecondidtionCheckRegion = Region , PrecondidtionCheckFlexnetVersion = FlexnetVersion }; var file = new RecoverySettings() { PcbID = PcbID, RadioFrequencyMhz = RadioFrq, Region = Region, Release = FlexnetVersion };
file.RecoveryRegisters = new List<ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem>(); file.RecoveryRegisters = new List<ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem>();
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_WakeupInterval", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x03 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x03 } }); file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x00 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SampleRate", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x02 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x02 } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_DisplayPow10", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0xFD }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0xFD } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "CUSTOMER_SerialNumber", WriteValue = new byte[] { 0x01, 0x02, 0x03, 0x04,0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00 }, IsCiritcal = false, ReadbackValue = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_StoreConfiguration", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
var csdRet = OrderProgrammingParameters.GetProgrammingParameters(PcbID.ToString(), GlobalConfig.connectionString.Value);
foreach (var item in csdRet.Where(w => w.Source == Logic.ProductionOrderCore.ProgrammingSource.Vako))
{
file.RecoveryRegisters.Add(new RecoveryRegisterItem()
{
RegisterIdent = item.RegisterName,
WriteValue = item.RegisterValue,
ReadbackValue = null,
IsCiritcal = false,
Access = RegisterRecoveryAccess.SetAlways,
});
}
foreach (var item in csdRet.Where(w => w.Source == Logic.ProductionOrderCore.ProgrammingSource.Csd))
{
file.RecoveryRegisters.Add(new RecoveryRegisterItem()
{
RegisterIdent = item.RegisterName,
WriteValue = item.RegisterValue,
ReadbackValue = null,
IsCiritcal = false,
Access = RegisterRecoveryAccess.SetAlways,
});
}
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_SystemState", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x0c } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_MainAlarmMask", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_ExtendedAlarmMask", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_SystemState", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0xFF }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x0c } });
var blacklist = new List<string>()
{
"CUSTOMER_RebootCount",
"GENESISFLOW_ForwardArrow",
"SENSUSRADIO_FrequencyOffset",
"SENSUSRADIO_FrequencyIndicator",
"PERIODICLOG_AverageFlowPeriod",
"PERIODICLOG_PeriodicLogLifeTimeCounter",
"SENSUSRADIO_MetroRadioLifeTimeCounter"
};
var Crit = new List<string>()
{
"GENESISFLOW_SealDisplay",
"GENESISFLOW_MeterSize",
"GENESISFLOW_DisplayUnits",
"METROLOGYASST_FlowUnits",
"METROLOGYASST_FlowPoint",
"METROLOGYASST_PressurePresent",
"GENESISFLOW_DisplayPow10",
"POWERMON_WarnFromClamp",
"SYSTEM_UpgradePermissions",
"POWERMON_BatteryQuantity",
"GENESISFLOW_LedMode",
"GENESISFLOW_LowFlowMaxPeriod",
"GENESISFLOW_LowFlowThreshold",
"GENESISFLOW_MaxValidAmplitude",
"GENESISFLOW_MaxValidDeltaToF",
"GENESISFLOW_MaxValidToF",
"GENESISFLOW_MinValidAmplitude",
"GENESISFLOW_MinValidToF",
"GENESISFLOW_Timeout",
"CUSTOMER_Locale",
"SENSUSRADIO_EncryptionKey"
};
file.RecoveryRegisters.Where(d => Crit.Contains(d.RegisterIdent)).ToList().ForEach(f => { f.IsCiritcal = true; f.ReadbackValue = f.WriteValue; });
var onlyIfDefaultl = new List<string>()
{
"METROLOGYASST_PulseWeight",
"METROLOGYASST_PressureUnits",
"METROLOGYASST_TemperatureUnits",
"METROLOGYASST_PulseLength",
"METROLOGYASST_PulseMode",
"CUSTOMER_LeakTimeThreshold",
"CUSTOMER_ExcessFlowTimeThreshold",
"CUSTOMER_ReverseFlowTimeThreshold",
"CUSTOMER_TemperatureHighThreshold",
"CUSTOMER_TemperatureHighDelay",
"CUSTOMER_TemperatureLowThreshold",
"CUSTOMER_TemperatureLowDelay",
"CUSTOMER_PressureHighThreshold",
"CUSTOMER_PressureHighDelay",
"CUSTOMER_PressureLowThreshold",
"CUSTOMER_PressureLowDelay",
"CUSTOMER_LeakFlowThreshold",
"METROLOGYASST_PressureOffset",
};
file.RecoveryRegisters.Where(d => onlyIfDefaultl.Contains(d.RegisterIdent)).ToList().ForEach(f => f.Access = RegisterRecoveryAccess.SetIfDefault);
return Request.CreateResponse(HttpStatusCode.OK, file); return Request.CreateResponse(HttpStatusCode.OK, file);
} }
[Route("AddNewUser"), HttpGet] [Route("AddNewUser"), HttpGet]
@@ -0,0 +1,776 @@
using Newtonsoft.Json;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using Xylem.Common.Cryptology.Security;
using Xylem.ServiceFwUpdate.Common.FwUpdateDb;
using Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery;
namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public class LutController : ApiController
{
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
}
//
[Route("GetLutList"), HttpGet]
public async Task<HttpResponseMessage> GetLutList()
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<UserInformation>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" SELECT [Id] , lut.[FileID] ,[DataLength] ,[Version] ,[FileCrc] ,[MeterSize] ,[FileContent] FROM[Auftrag].[dbo].[Cordonel_Lut] lut inner join [Auftrag].[dbo].[File] f on lut.FileID = f.FileId");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
foreach (DataRow row in dbResult.Rows)
{
ret.Add(
new UserInformation((int)row["UserId"])
{
FullName = row["FullName"] == DBNull.Value ? "" : (string)row["FullName"],
LogInName = (string)row["LogInName"],
Domain = (string)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (string)row["HardwareId"],
PasswordHash = row["PasswordHash"] == DBNull.Value ? "" : (string)row["PasswordHash"],
RegisterDate = (DateTimeOffset)row["RegisterDate"],
ValidDate = (DateTimeOffset)row["ValidDate"],
AccountActive = (bool)row["AccountActive"],
});
}
}
return Request.CreateResponse(HttpStatusCode.OK, true);
//return Request.CreateResponse(HttpStatusCode.OK, getUserList(LogInName, Id));
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("GetAllBuilderOperator"), HttpGet]
public async Task<HttpResponseMessage> GetAllBuilderOperator()
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<UserInformation>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" select UserId, FullName,LogInName, Domain,HardwareId,AccountActive from FWUpdateBuilderUser ");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
foreach (DataRow row in dbResult.Rows)
{
ret.Add(
new UserInformation((int)row["UserId"])
{
FullName = row["FullName"] == DBNull.Value ? "" : (string)row["FullName"],
LogInName = (string)row["LogInName"],
Domain = (string)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (string)row["HardwareId"],
AccountActive = (bool)row["AccountActive"],
});
}
return Request.CreateResponse(HttpStatusCode.OK, ret);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("RefreshUsersHardwareId"), HttpGet]
public async Task<HttpResponseMessage> RefreshUsersHardwareId(int id, string HardwareId)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<UserInformation>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" Update FWUpdateUser set HardwareId = '{HardwareId}' where UserId = {id} ");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
return Request.CreateResponse(HttpStatusCode.OK, true);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("RefreshUsersPasswordHash"), HttpGet]
public async Task<HttpResponseMessage> RefreshUsersPasswordHash(int id, string PasswordHash)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<UserInformation>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" Update FWUpdateUser set PasswordHash = '{PasswordHash}' where UserId = {id} ");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
return Request.CreateResponse(HttpStatusCode.OK, true);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("EditUserValidity"), HttpGet]
public async Task<HttpResponseMessage> EditUserValidity(int id, DateTimeOffset? ValidDate = null, bool? AccountActive = null)
{
return await Task.Run(() =>
{
try
{
if (ValidDate.HasValue || AccountActive.HasValue)
{
var ret = new System.Collections.Generic.List<UserInformation>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" Update FWUpdateUser set ");
if (ValidDate.HasValue)
{
sb.AppendLine($" ValidDate = '{ValidDate.Value.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss +00:00")}' ");
}
if (AccountActive.HasValue)
{
if (ValidDate.HasValue)
{
sb.AppendLine($" , ");
}
if (AccountActive.Value)
{
sb.AppendLine($" AccountActive = 1 ");
}
else
{
sb.AppendLine($" AccountActive = 0 ");
}
}
sb.AppendLine($" where UserId = {id} ");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
return Request.CreateResponse(HttpStatusCode.OK, true);
}
}
return Request.CreateResponse(HttpStatusCode.InternalServerError, "no change");
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("GetFileContent"), HttpGet]
public async Task<HttpResponseMessage> GetFileContent(int FileId)
{
return await Task.Run(() =>
{
try
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" SELECT TOP (1) [FileContent] FROM [Auftrag].[dbo].[File] where FileId = {FileId}");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
return Request.CreateResponse(HttpStatusCode.OK, dbResult.Rows[0][0]);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("GetFWUpdateSafeContainers"), HttpGet]
public async Task<HttpResponseMessage> GetFWUpdateSafeContainers(int UserId)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<FwUpdateSafeDb>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" select * from [dbo].[FWUpdateSafeContainer] ");
sb.Append($" where FWUpdateSafeContainer_UserId ={UserId} ");
//FWUpdateSafeContainer_ValidDate >= CURRENT_TIMESTAMP and
var dbResult = dataacces.ExecuteQuery(sb.ToString());
foreach (DataRow row in dbResult.Rows)
{
ret.Add(
new FwUpdateSafeDb()
{
ContainerId = (int)row["FWUpdateSafeContainer_ID"],
Name = (string)row["FWUpdateSafeContainer_Name"],
UserId = (int)row["FWUpdateSafeContainer_UserId"],
FilePartId = (int)row["FWUpdateSafeContainer_FileId"],
ValidDate = (DateTime)row["FWUpdateSafeContainer_ValidDate"]
});
}
}
return Request.CreateResponse(HttpStatusCode.OK, ret);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("AddPcbIdsToSafe"), HttpPost]
public async Task<HttpResponseMessage> AddPcbIdsToSafe(int ContainerDbId, [FromBody] List<int> PcbIds)
{
return await Task.Run(() =>
{
try
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
StringBuilder sb = null;
foreach (var item in PcbIds)
{
if (sb == null)
{
sb = new StringBuilder();
sb.AppendLine($" insert into FWUpdateSafeContainerPcbIds ");
}
else
{
sb.AppendLine($" UNION ");
}
sb.AppendLine($" SELECT {ContainerDbId}, {item}");
}
var dbResult = dataacces.ExecuteQuery(sb.ToString());
return Request.CreateResponse(HttpStatusCode.OK, true);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("GetPcbIdsFromSafe"), HttpGet]
public async Task<HttpResponseMessage> GetPcbIdsFromSafe(int ContainerDbId)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<int>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" select [FWUpdateSafeContainer_PcbId] from [dbo].[FWUpdateSafeContainerPcbIds] ");
sb.Append($" where [FWUpdateSafeContainer_ID] = {ContainerDbId} ");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
foreach (DataRow row in dbResult.Rows)
{
ret.Add((int)row["FWUpdateSafeContainer_PcbId"]);
}
}
return Request.CreateResponse(HttpStatusCode.OK, ret);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("PostFWUpdateSafeOdd"), HttpPost]
public async Task<HttpResponseMessage> PostFWUpdateSafeOdd(int PUserId, string PFileName, DateTime PValidDate, string PBuilderOperatorName = "none")
{
var inpStrem = HttpContext.Current.Request.GetBufferlessInputStream(true);
var inpHeaders = Request.Content.Headers;
return await Task.Run(async () =>
{
try
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var parameters = new List<System.Data.SqlClient.SqlParameter>();
var FileName = new System.Data.SqlClient.SqlParameter("@FileName", SqlDbType.NVarChar, 50);
var UserId = new System.Data.SqlClient.SqlParameter("@UserId", SqlDbType.Int);
var ValidDate = new System.Data.SqlClient.SqlParameter("@ValidDate", SqlDbType.Date);
FileName.Value = PFileName;
UserId.Value = PUserId;
ValidDate.Value = PValidDate;
parameters.Add(ValidDate);
var sb = new StringBuilder();
sb.AppendLine($" Declare @FileID as int ");
sb.AppendLine($" Declare @FileName as NVarChar(50) ");
sb.AppendLine($" Declare @UserId as int ");
sb.AppendLine($" set @FileName = '{PFileName}' ");
sb.AppendLine($" set @UserId = {PUserId} ");
//sb.AppendLine($" INSERT INTO [dbo].[File] ([FileContent], [FileName]) VALUES (@FileContent, @FileName) ;");
//sb.AppendLine($" SELECT @FileID = @@IDENTITY; ");
sb.AppendLine($" INSERT INTO [dbo].[FWUpdateSafeContainer] ([FWUpdateSafeContainer_Name],[FWUpdateSafeContainer_UserId],[FWUpdateSafeContainer_FileId],[FWUpdateSafeContainer_ValidDate])");
sb.AppendLine($" VALUES(@FileName,@UserId,0,@ValidDate); ");
sb.AppendLine($" select @@IDENTITY as ContainerID, @FileID as FilePartId ");
var retDT = dataacces.ExecuteQuery(sb.ToString(), parameters);
var newID = Convert.ToInt32(retDT.Rows[0][0].ToString());
var fileuploadPath = $"C:\\\\Temp\\{newID}\\";
Directory.CreateDirectory(fileuploadPath);
var provider = new MultipartFormDataStreamProvider(fileuploadPath);
var content = new StreamContent(inpStrem);
foreach (var header in inpHeaders)
{
content.Headers.TryAddWithoutValidation(header.Key, header.Value);
}
await content.ReadAsMultipartAsync(provider);
string uploadingFileName = provider.FileData.Select(x => x.LocalFileName).FirstOrDefault();
string originalFileName = String.Concat(fileuploadPath, "\\" + (provider.Contents[0].Headers.ContentDisposition.FileName).Trim(new Char[] { '"' }));
if (File.Exists(originalFileName))
{
File.Delete(originalFileName);
}
File.Move(uploadingFileName, originalFileName);
return Request.CreateResponse(HttpStatusCode.OK, newID);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("GetFWUpdateSafeContainerContent"), HttpGet]
public async Task<HttpResponseMessage> GetFWUpdateSafeContainerContent(int SafeContainerId)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<FwUpdateSafeDb>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" select * from [dbo].[FWUpdateSafeContainer] ");
sb.Append($" where FWUpdateSafeContainer_ValidDate >= CURRENT_TIMESTAMP and FWUpdateSafeContainer_ID ={SafeContainerId} ");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
foreach (DataRow row in dbResult.Rows)
{
var content = new byte[] { };
var filePath = $"C:\\\\Temp\\{(int)row["FWUpdateSafeContainer_ID"]}\\{(string)row["FWUpdateSafeContainer_Name"]}";
if (File.Exists(filePath))
{
content = File.ReadAllBytes(filePath);
}
else
{
content = ASCIIEncoding.ASCII.GetBytes("File Not Found");
}
ret.Add(
new FwUpdateSafeDb()
{
ContainerId = (int)row["FWUpdateSafeContainer_ID"],
Name = (string)row["FWUpdateSafeContainer_Name"],
UserId = (int)row["FWUpdateSafeContainer_UserId"],
FilePartId = (int)row["FWUpdateSafeContainer_FileId"],
ValidDate = (DateTime)row["FWUpdateSafeContainer_ValidDate"],
Content = content
});
}
}
return Request.CreateResponse(HttpStatusCode.OK, ret);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("PostFWUpdateSafe"), HttpPost]
public async Task<HttpResponseMessage> PostFWUpdateSafe([FromBody] FwUpdateSafeDb fwc)
{
return await Task.Run(() =>
{
try
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var parameters = new List<System.Data.SqlClient.SqlParameter>();
var FileContent = new System.Data.SqlClient.SqlParameter("FileContent", SqlDbType.VarBinary);
// var FileName = new System.Data.SqlClient.SqlParameter("FileName", SqlDbType.NVarChar, 50);
var UserId = new System.Data.SqlClient.SqlParameter("UserId", SqlDbType.Int);
var ValidDate = new System.Data.SqlClient.SqlParameter("ValidDate", SqlDbType.Date);
// FileName.Value = fwc.Name;
FileContent.Value = fwc.Content;
UserId.Value = fwc.UserId;
ValidDate.Value = fwc.ValidDate.Date;
//parameters.Add(FileName);
parameters.Add(UserId);
parameters.Add(FileContent);
parameters.Add(ValidDate);
var sb = new StringBuilder();
sb.AppendLine($" Declare @FileID as int ");
sb.AppendLine($" INSERT INTO [dbo].[File] ([FileContent], [FileName]) VALUES (@FileContent, 't') ;");
sb.AppendLine($" SELECT @FileID = @@IDENTITY; ");
sb.AppendLine($" INSERT INTO [dbo].[FWUpdateSafeContainer] ([FWUpdateSafeContainer_Name],[FWUpdateSafeContainer_UserId],[FWUpdateSafeContainer_FileId],[FWUpdateSafeContainer_ValidDate])");
sb.AppendLine($" VALUES('t',@UserId,@FileID,@ValidDate); ");
sb.AppendLine($" select @@IDENTITY as ContainerID, @FileID as FilePartId ");
var retDT = dataacces.ExecuteQuery(sb.ToString(), parameters);
var newID = Convert.ToInt32(retDT.Rows[0][0].ToString());
return Request.CreateResponse(HttpStatusCode.OK, newID);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
public virtual byte[] GetFileBytes(HttpPostedFile uploadedFile)
{
var bytes = new byte[uploadedFile.ContentLength];
uploadedFile.InputStream.Read(bytes, 0, uploadedFile.ContentLength);
return bytes;
}
[Route("PostFWUpdateReportFile"), HttpPost]
public async Task<HttpResponseMessage> PostFWUpdateReportFiles([FromBody] FwUpdateReportDb FileContent)
{
return await Task.Run(() =>
{
try
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var parameters = new List<System.Data.SqlClient.SqlParameter>();
var DbFileContent = new System.Data.SqlClient.SqlParameter("@FileContent", SqlDbType.VarBinary);
var DbFileName = new System.Data.SqlClient.SqlParameter("@FileName", SqlDbType.NVarChar, 50);
DbFileName.Value = FileContent.FileName;
DbFileContent.Value = UTF32Encoding.UTF32.GetBytes(JsonConvert.SerializeObject(FileContent));
parameters.Add(DbFileName);
parameters.Add(DbFileContent);
var sb = new StringBuilder();
sb.AppendLine($" Declare @FileID as int ");
sb.AppendLine($" INSERT INTO [dbo].[File] ([FileContent], [FileName]) VALUES (@FileContent, @FileName) ;");
sb.AppendLine($" SELECT @FileID = @@IDENTITY; ");
sb.AppendLine($" INSERT INTO [dbo].[FWUpdateReports] ([FWUpdateReport_Name],[FWUpdateReport_UserId], [FWUpdateReport_FileId],[FWUpdateReport_Date],[FWUpdateReport_PcbId], [FWUpdateReport_OrderNr], [FWUpdateReport_OrderPos]) ");
sb.AppendLine($" VALUES(@FileName,{FileContent.UserId},@FileID,CURRENT_TIMESTAMP, {FileContent.PcbId}, {FileContent.OrderNr}, {FileContent.OrderPos} ); ");
sb.AppendLine($" select @@IDENTITY as FWUpdateReportsId, @FileID as FilePartId ");
var retDT = dataacces.ExecuteQuery(sb.ToString(), parameters);
var newID = Convert.ToInt32(retDT.Rows[0][0].ToString());
return Request.CreateResponse(HttpStatusCode.OK, newID);
}
return Request.CreateResponse(HttpStatusCode.OK, false);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("GetFWUpdateReportFile"), HttpGet]
public async Task<HttpResponseMessage> GetFWUpdateReportFile(int? PcbId = null, int? UserId = null, int? OrderNr = null, bool WithContent = true)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<FwUpdateReportDb>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" select FWUpdateReport_ID, FWUpdateReport_Name, FWUpdateReport_UserId, FWUpdateReport_FileId, FWUpdateReport_Date, FWUpdateReport_PcbId, FWUpdateReport_OrderNr ");
if (WithContent)
{
sb.Append(", FileContent ");
}
sb.AppendLine($" from [dbo].[FWUpdateReports] r ");
if (WithContent)
{
sb.AppendLine($" inner join [dbo].[File] f on r.FWUpdateReport_FileId = f.FileId ");
}
sb.AppendLine($" where FWUpdateReport_ID > 0 ");
if (PcbId.HasValue)
{
sb.AppendLine($" and FWUpdateReport_PcbId = {PcbId.Value}");
}
if (UserId.HasValue)
{
sb.AppendLine($" and FWUpdateReport_UserId = {UserId.Value}");
}
if (OrderNr.HasValue)
{
sb.AppendLine($" and FWUpdateReport_OrderNr = {OrderNr.Value}");
}
var dbResult = dataacces.ExecuteQuery(sb.ToString());
foreach (DataRow row in dbResult.Rows)
{
var addOBJ = JsonConvert.DeserializeObject<FwUpdateReportDb>(UTF32Encoding.UTF32.GetString((byte[])row["FileContent"]));
addOBJ.FileId = (int)row["FWUpdateReport_ID"];
addOBJ.Date = (DateTime)row["FWUpdateReport_Date"];
ret.Add(addOBJ);
}
}
return Request.CreateResponse(HttpStatusCode.OK, ret);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
[Route("GetFakeRecoveryFile"), HttpGet]
public async Task<HttpResponseMessage> GetFakeRecoveryFile(int PcbID, int? RadioFrq, string Region, string FlexnetVersion)
{
var file = new RecoverySettings() { PcbID = PcbID, RadioFrequencyMhz = RadioFrq , Region = Region , Release = FlexnetVersion };
file.RecoveryRegisters = new List<ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem>();
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_WakeupInterval", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x03 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x03 } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SampleRate", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x02 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x02 } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_DisplayPow10", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0xFD }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0xFD } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "CUSTOMER_SerialNumber", WriteValue = new byte[] { 0x01, 0x02, 0x03, 0x04,0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00 }, IsCiritcal = false, ReadbackValue = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new ServiceFwUpdate.Common.FwUpdateSafe.RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_StoreConfiguration", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
return Request.CreateResponse(HttpStatusCode.OK, file);
}
[Route("AddNewUser"), HttpGet]
public async Task<HttpResponseMessage> AddNewUser(string FullName, string LogInName, string Domain, string HardwareId = null, string PasswordHash = null)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<UserInformation>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" insert into FWUpdateUser ");
sb.AppendLine($" select ");
sb.AppendLine($" '{FullName}', ");
sb.AppendLine($" '{LogInName}', ");
sb.AppendLine($" '{Domain}', ");
sb.AppendLine(string.IsNullOrEmpty(HardwareId) ? "null , " : $"'{HardwareId}' ,");
sb.AppendLine(string.IsNullOrEmpty(PasswordHash) ? "null , " : $"'{PasswordHash}' ,");
sb.AppendLine($" '{DateTimeOffset.UtcNow.ToString("yyyy-MM-dd HH:mm:ss +01:00")}', ");
sb.AppendLine($" '{DateTimeOffset.UtcNow.ToString("yyyy-MM-dd HH:mm:ss +01:00")}', ");
sb.AppendLine($" 0 ");
sb.AppendLine($" select @@IDENTITY ");
var dbResult = dataacces.ExecuteQuery(sb.ToString());
var newID = Convert.ToInt32(dbResult.Rows[0][0].ToString());
return Request.CreateResponse(HttpStatusCode.OK, newID);
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
});
}
}
}
@@ -222,6 +222,7 @@
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" /> <Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
<Compile Include="Controllers\FinalCheckController.cs" /> <Compile Include="Controllers\FinalCheckController.cs" />
<Compile Include="Controllers\FileUpToDateController.cs" /> <Compile Include="Controllers\FileUpToDateController.cs" />
<Compile Include="Controllers\LUTController.cs" />
<Compile Include="Controllers\FwUpdateController.cs" /> <Compile Include="Controllers\FwUpdateController.cs" />
<Compile Include="Controllers\TestBenchController.cs" /> <Compile Include="Controllers\TestBenchController.cs" />
<Compile Include="Controllers\MarriageController.cs" /> <Compile Include="Controllers\MarriageController.cs" />
@@ -1 +1 @@
f64d563def603c89cafafa61a3219ba97e1e344c 0d85a5b3a7561b41163c20e5dc7713bcd0d65555
+353
View File
@@ -0,0 +1,353 @@
namespace Xylem.Common.Ui.GenesisToolBox
{
partial class FrmLutManagement
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label7 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.tbxLutFilePathName = new System.Windows.Forms.TextBox();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.dlgOpenLuFile = new System.Windows.Forms.OpenFileDialog();
this.tmrProgressUpdate = new System.Windows.Forms.Timer(this.components);
this.tbxRegionRadio = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.tbxMeterFw = new System.Windows.Forms.TextBox();
this.tbxMeterMeterSize = new System.Windows.Forms.TextBox();
this.tbxMeterLutCrc = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.lblFwVersion = new System.Windows.Forms.Label();
this.cbForProd = new System.Windows.Forms.CheckBox();
this.btnOpenLutFile = new System.Windows.Forms.Button();
this.btnStore = new System.Windows.Forms.Button();
this.dgvLuts = new System.Windows.Forms.DataGridView();
this.FileId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FileName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FW = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.LUTCRC = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MeterSize = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Region = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ForProd = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Dele = new System.Windows.Forms.DataGridViewButtonColumn();
this.btnLoad = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvLuts)).BeginInit();
this.SuspendLayout();
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(16, 9);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(197, 16);
this.label7.TabIndex = 32;
this.label7.Text = "Cordonel LUT Management";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(17, 50);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(63, 13);
this.label4.TabIndex = 1;
this.label4.Text = "Path Name:";
this.label4.Click += new System.EventHandler(this.label4_Click);
//
// tbxLutFilePathName
//
this.tbxLutFilePathName.Location = new System.Drawing.Point(97, 47);
this.tbxLutFilePathName.Name = "tbxLutFilePathName";
this.tbxLutFilePathName.ReadOnly = true;
this.tbxLutFilePathName.Size = new System.Drawing.Size(144, 20);
this.tbxLutFilePathName.TabIndex = 2;
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// pictureBox1
//
this.pictureBox1.Image = global::Xylem.Common.Ui.GenesisToolBox.Properties.Resources.SensusLogoXylem;
this.pictureBox1.Location = new System.Drawing.Point(611, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(102, 54);
this.pictureBox1.TabIndex = 29;
this.pictureBox1.TabStop = false;
//
// dlgOpenLuFile
//
this.dlgOpenLuFile.Filter = "metrology lookup tables (*.lut)|*.lut";
//
// tbxRegionRadio
//
this.tbxRegionRadio.Location = new System.Drawing.Point(97, 151);
this.tbxRegionRadio.Name = "tbxRegionRadio";
this.tbxRegionRadio.ReadOnly = true;
this.tbxRegionRadio.Size = new System.Drawing.Size(144, 20);
this.tbxRegionRadio.TabIndex = 54;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(17, 158);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(44, 13);
this.label8.TabIndex = 53;
this.label8.Text = "Region:";
//
// tbxMeterFw
//
this.tbxMeterFw.Location = new System.Drawing.Point(97, 73);
this.tbxMeterFw.Name = "tbxMeterFw";
this.tbxMeterFw.ReadOnly = true;
this.tbxMeterFw.Size = new System.Drawing.Size(144, 20);
this.tbxMeterFw.TabIndex = 51;
//
// tbxMeterMeterSize
//
this.tbxMeterMeterSize.Location = new System.Drawing.Point(97, 125);
this.tbxMeterMeterSize.Name = "tbxMeterMeterSize";
this.tbxMeterMeterSize.ReadOnly = true;
this.tbxMeterMeterSize.Size = new System.Drawing.Size(144, 20);
this.tbxMeterMeterSize.TabIndex = 50;
//
// tbxMeterLutCrc
//
this.tbxMeterLutCrc.Location = new System.Drawing.Point(97, 99);
this.tbxMeterLutCrc.Name = "tbxMeterLutCrc";
this.tbxMeterLutCrc.ReadOnly = true;
this.tbxMeterLutCrc.Size = new System.Drawing.Size(144, 20);
this.tbxMeterLutCrc.TabIndex = 49;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(17, 132);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(60, 13);
this.label5.TabIndex = 48;
this.label5.Text = "Meter Size:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(17, 106);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 13);
this.label6.TabIndex = 47;
this.label6.Text = "LUT CRC:";
this.label6.Click += new System.EventHandler(this.label6_Click);
//
// lblFwVersion
//
this.lblFwVersion.AutoSize = true;
this.lblFwVersion.Location = new System.Drawing.Point(17, 80);
this.lblFwVersion.Name = "lblFwVersion";
this.lblFwVersion.Size = new System.Drawing.Size(27, 13);
this.lblFwVersion.TabIndex = 46;
this.lblFwVersion.Text = "FW:";
//
// cbForProd
//
this.cbForProd.AutoSize = true;
this.cbForProd.Location = new System.Drawing.Point(97, 203);
this.cbForProd.Name = "cbForProd";
this.cbForProd.Size = new System.Drawing.Size(95, 17);
this.cbForProd.TabIndex = 55;
this.cbForProd.Text = "For Production";
this.cbForProd.UseVisualStyleBackColor = true;
//
// btnOpenLutFile
//
this.btnOpenLutFile.Location = new System.Drawing.Point(260, 47);
this.btnOpenLutFile.Name = "btnOpenLutFile";
this.btnOpenLutFile.Size = new System.Drawing.Size(102, 29);
this.btnOpenLutFile.TabIndex = 56;
this.btnOpenLutFile.Text = "Open";
this.btnOpenLutFile.UseVisualStyleBackColor = true;
this.btnOpenLutFile.Click += new System.EventHandler(this.btnOpenLutFile_Click);
//
// btnStore
//
this.btnStore.Location = new System.Drawing.Point(20, 226);
this.btnStore.Name = "btnStore";
this.btnStore.Size = new System.Drawing.Size(342, 28);
this.btnStore.TabIndex = 57;
this.btnStore.Text = "Store";
this.btnStore.UseVisualStyleBackColor = true;
this.btnStore.Click += new System.EventHandler(this.button1_Click);
//
// dgvLuts
//
this.dgvLuts.AllowUserToAddRows = false;
this.dgvLuts.AllowUserToDeleteRows = false;
this.dgvLuts.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvLuts.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.FileId,
this.FileName,
this.FW,
this.LUTCRC,
this.MeterSize,
this.Region,
this.ForProd,
this.Dele});
this.dgvLuts.Location = new System.Drawing.Point(3, 378);
this.dgvLuts.Name = "dgvLuts";
this.dgvLuts.ReadOnly = true;
this.dgvLuts.RowHeadersVisible = false;
this.dgvLuts.Size = new System.Drawing.Size(775, 149);
this.dgvLuts.TabIndex = 58;
//
// FileId
//
this.FileId.HeaderText = "FileId";
this.FileId.Name = "FileId";
this.FileId.ReadOnly = true;
//
// FileName
//
this.FileName.HeaderText = "FileName";
this.FileName.Name = "FileName";
this.FileName.ReadOnly = true;
//
// FW
//
this.FW.HeaderText = "Fw";
this.FW.Name = "FW";
this.FW.ReadOnly = true;
//
// LUTCRC
//
this.LUTCRC.HeaderText = "LUT CRC";
this.LUTCRC.Name = "LUTCRC";
this.LUTCRC.ReadOnly = true;
//
// MeterSize
//
this.MeterSize.HeaderText = "MeterSize";
this.MeterSize.Name = "MeterSize";
this.MeterSize.ReadOnly = true;
//
// Region
//
this.Region.HeaderText = "Region";
this.Region.Name = "Region";
this.Region.ReadOnly = true;
//
// ForProd
//
this.ForProd.HeaderText = "ForProd";
this.ForProd.Name = "ForProd";
this.ForProd.ReadOnly = true;
//
// Dele
//
this.Dele.HeaderText = "Delete";
this.Dele.Name = "Dele";
this.Dele.ReadOnly = true;
//
// btnLoad
//
this.btnLoad.Location = new System.Drawing.Point(12, 344);
this.btnLoad.Name = "btnLoad";
this.btnLoad.Size = new System.Drawing.Size(342, 28);
this.btnLoad.TabIndex = 59;
this.btnLoad.Text = "Load";
this.btnLoad.UseVisualStyleBackColor = true;
//
// FrmLutManagement
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 561);
this.Controls.Add(this.btnLoad);
this.Controls.Add(this.dgvLuts);
this.Controls.Add(this.btnStore);
this.Controls.Add(this.btnOpenLutFile);
this.Controls.Add(this.cbForProd);
this.Controls.Add(this.tbxRegionRadio);
this.Controls.Add(this.label8);
this.Controls.Add(this.tbxMeterFw);
this.Controls.Add(this.tbxMeterMeterSize);
this.Controls.Add(this.tbxLutFilePathName);
this.Controls.Add(this.label4);
this.Controls.Add(this.tbxMeterLutCrc);
this.Controls.Add(this.label5);
this.Controls.Add(this.label6);
this.Controls.Add(this.lblFwVersion);
this.Controls.Add(this.label7);
this.Controls.Add(this.pictureBox1);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(800, 600);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(800, 600);
this.Name = "FrmLutManagement";
this.Text = "Metrology Lookup Table Managment";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvLuts)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox tbxLutFilePathName;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.OpenFileDialog dlgOpenLuFile;
private System.Windows.Forms.Timer tmrProgressUpdate;
private System.Windows.Forms.TextBox tbxRegionRadio;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox tbxMeterFw;
private System.Windows.Forms.TextBox tbxMeterMeterSize;
private System.Windows.Forms.TextBox tbxMeterLutCrc;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label lblFwVersion;
private System.Windows.Forms.CheckBox cbForProd;
private System.Windows.Forms.Button btnOpenLutFile;
private System.Windows.Forms.Button btnStore;
private System.Windows.Forms.DataGridView dgvLuts;
private System.Windows.Forms.DataGridViewTextBoxColumn FileId;
private System.Windows.Forms.DataGridViewTextBoxColumn FileName;
private System.Windows.Forms.DataGridViewTextBoxColumn FW;
private System.Windows.Forms.DataGridViewTextBoxColumn LUTCRC;
private System.Windows.Forms.DataGridViewTextBoxColumn MeterSize;
private System.Windows.Forms.DataGridViewTextBoxColumn Region;
private System.Windows.Forms.DataGridViewCheckBoxColumn ForProd;
private System.Windows.Forms.DataGridViewButtonColumn Dele;
private System.Windows.Forms.Button btnLoad;
}
}
@@ -0,0 +1,103 @@
using System;
using System.Drawing;
using System.Globalization;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Logic.ProductionToProductMapper.Cordonel;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Utils.ProcessExec.EventArguments;
namespace Xylem.Common.Ui.GenesisToolBox
{
/// <summary>
/// FW update form
/// </summary>
public partial class FrmLutManagement : Form
{
#region Variables
private readonly MeterBatch _meterBatch = new MeterBatch();
private GenesisMeter _currentGenesis;
private const String StrConnecting = "Connecting to PCB";
private const String StrNotConnected = "NOT CONNECTED";
private const String StrPartPcbConnected = "PCB ID: ";
private const String StrOverallProcess = "Overall Process";
private MeterLutUpdate _meterLutUpdate;
private String _lastFwUpdateState;
private Int32 _lastSingleProgress;
private DateTimeOffset _startTime;
private Boolean _resetTimeMeasurement;
private readonly Boolean _updateGui = true;
private Boolean _lutFileValid;
private Boolean _tryConnectPcb;
private Boolean _lutFileSuccessfulWritten;
private const String StrUpdateErrorMessage = "METROLOGY LOOKUP TABLE UPDATE FAILED!";
private const String StrUpdateSuccessMessage = "Metrology lookup table successfulley written!";
private const String StrLutFileInvalid = "LUT FILE INVALID";
private const String StrLutFileValid = "LUT file loaded";
// external update remarks form
private readonly FrmHistory _frmHistory = new FrmHistory();
private readonly Version _version;
// status information
private static readonly Color ColorDefault = Color.Black;
private static readonly Color ColorSuccess = Color.Green;
private static readonly Color ColorProcessFailed = Color.Red;
private const String StrSeparator = "-----------------------------------------------------" +
"-----------------------------------------------------";
#endregion
/// <summary>
/// Ctor FW update
/// </summary>
public FrmLutManagement()
{
InitializeComponent();
var cultureInfo = new CultureInfo("en-GB");
Thread.CurrentThread.CurrentUICulture = cultureInfo;
Thread.CurrentThread.CurrentCulture = cultureInfo;
_version = Assembly.GetExecutingAssembly().GetName().Version;
}
private void btnOpenLutFile_Click(object sender, EventArgs e)
{
}
/// <summary>
/// Clear data table and set genesis to not connected
/// </summary>
private void Init()
{
}
private void label6_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
}
}
@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 17</value>
</metadata>
<metadata name="dlgOpenLuFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>144, 17</value>
</metadata>
<metadata name="tmrProgressUpdate.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>274, 17</value>
</metadata>
<metadata name="FileId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FileName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FW.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="LUTCRC.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MeterSize.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Region.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ForProd.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Dele.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FileId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FileName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FW.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="LUTCRC.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MeterSize.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Region.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ForProd.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Dele.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
+105
View File
@@ -0,0 +1,105 @@
namespace Xylem.Common.Ui.GenesisToolBox
{
partial class FrmMapping
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.cbComSlot = new System.Windows.Forms.ComboBox();
this.btnConnect = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 11);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(28, 13);
this.label2.TabIndex = 29;
this.label2.Text = "Slot:";
//
// cbComSlot
//
this.cbComSlot.FormattingEnabled = true;
this.cbComSlot.Items.AddRange(new object[] {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20"});
this.cbComSlot.Location = new System.Drawing.Point(43, 7);
this.cbComSlot.Name = "cbComSlot";
this.cbComSlot.Size = new System.Drawing.Size(37, 21);
this.cbComSlot.TabIndex = 28;
this.cbComSlot.Text = "1";
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(95, 7);
this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(116, 24);
this.btnConnect.TabIndex = 30;
this.btnConnect.Text = "Get";
this.btnConnect.UseVisualStyleBackColor = true;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
//
// FrmMapping
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(474, 570);
this.Controls.Add(this.btnConnect);
this.Controls.Add(this.label2);
this.Controls.Add(this.cbComSlot);
this.Name = "FrmMapping";
this.Text = "FrmMapping";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cbComSlot;
private System.Windows.Forms.Button btnConnect;
}
}
+62
View File
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Xylem.Common.Ui.GenesisToolBox
{
public partial class FrmMapping : Form
{
public FrmMapping()
{
InitializeComponent();
}
private void btnConnect_Click(object sender, EventArgs e)
{
//if (cbComSlot.SelectedItem != null) // && cbComSlot.SelectedValue is ListBoxItem)
//{
// Int32 slotNR = 0;
// _currentPcbId = "";
// if (!string.IsNullOrEmpty(cbComSlot.SelectedItem.ToString()) &&
// int.TryParse(cbComSlot.SelectedItem.ToString(), out slotNR))
// {
// try
// {
// _meterBatch.RemoveAllMeters();
// _currentGenesis = new GenesisMeter();
// try
// {
// _currentGenesis.SetupFromConfigFile(slotNR);
// _meterBatch.AddMeter(_currentGenesis);
// }
// catch (Exception ex)
// {
// Logger.Value.Error(ex, $"Slot #{slotNR} failed: {ex.Message}");
// }
// _currentPcbId = _currentGenesis.GetPcbId();
// }
// catch (Exception ex)
// {
// Logger.Value.Error(ex, ex.Message);
// }
// }
//}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -245,6 +245,12 @@
<Compile Include="FrmHistory.Designer.cs"> <Compile Include="FrmHistory.Designer.cs">
<DependentUpon>FrmHistory.cs</DependentUpon> <DependentUpon>FrmHistory.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmLutManagement.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmLutManagement.Designer.cs">
<DependentUpon>FrmLutManagement.cs</DependentUpon>
</Compile>
<Compile Include="FrmLutUpdate.cs"> <Compile Include="FrmLutUpdate.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -263,6 +269,12 @@
<Compile Include="FrmLeagcyTestAppStart.Designer.cs"> <Compile Include="FrmLeagcyTestAppStart.Designer.cs">
<DependentUpon>FrmLeagcyTestAppStart.cs</DependentUpon> <DependentUpon>FrmLeagcyTestAppStart.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmMapping.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMapping.Designer.cs">
<DependentUpon>FrmMapping.cs</DependentUpon>
</Compile>
<Compile Include="FrmPressure.cs"> <Compile Include="FrmPressure.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -417,6 +429,10 @@
<EmbeddedResource Include="FrmHistory.resx"> <EmbeddedResource Include="FrmHistory.resx">
<DependentUpon>FrmHistory.cs</DependentUpon> <DependentUpon>FrmHistory.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmLutManagement.resx">
<DependentUpon>FrmLutManagement.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="FrmLutUpdate.resx"> <EmbeddedResource Include="FrmLutUpdate.resx">
<DependentUpon>FrmLutUpdate.cs</DependentUpon> <DependentUpon>FrmLutUpdate.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -429,6 +445,9 @@
<DependentUpon>FrmLeagcyTestAppStart.cs</DependentUpon> <DependentUpon>FrmLeagcyTestAppStart.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmMapping.resx">
<DependentUpon>FrmMapping.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmPressure.resx"> <EmbeddedResource Include="FrmPressure.resx">
<DependentUpon>FrmPressure.cs</DependentUpon> <DependentUpon>FrmPressure.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
+16 -3
View File
@@ -52,6 +52,7 @@
this.BtnFileSplit = new System.Windows.Forms.Button(); this.BtnFileSplit = new System.Windows.Forms.Button();
this.btnFiles = new System.Windows.Forms.Button(); this.btnFiles = new System.Windows.Forms.Button();
this.btnLegacyTestApp = new System.Windows.Forms.Button(); this.btnLegacyTestApp = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.gpGerneral.SuspendLayout(); this.gpGerneral.SuspendLayout();
this.gpLAA.SuspendLayout(); this.gpLAA.SuspendLayout();
this.gbDeveloper.SuspendLayout(); this.gbDeveloper.SuspendLayout();
@@ -59,6 +60,7 @@
// //
// gpGerneral // gpGerneral
// //
this.gpGerneral.Controls.Add(this.button4);
this.gpGerneral.Controls.Add(this.btnLutUpdate); this.gpGerneral.Controls.Add(this.btnLutUpdate);
this.gpGerneral.Controls.Add(this.button1); this.gpGerneral.Controls.Add(this.button1);
this.gpGerneral.Controls.Add(this.btnPressure); this.gpGerneral.Controls.Add(this.btnPressure);
@@ -100,7 +102,7 @@
// //
// btnPressure // btnPressure
// //
this.btnPressure.Location = new System.Drawing.Point(6, 365); this.btnPressure.Location = new System.Drawing.Point(4, 409);
this.btnPressure.Name = "btnPressure"; this.btnPressure.Name = "btnPressure";
this.btnPressure.Size = new System.Drawing.Size(152, 40); this.btnPressure.Size = new System.Drawing.Size(152, 40);
this.btnPressure.TabIndex = 15; this.btnPressure.TabIndex = 15;
@@ -110,7 +112,7 @@
// //
// btnConfiguration // btnConfiguration
// //
this.btnConfiguration.Location = new System.Drawing.Point(5, 365); this.btnConfiguration.Location = new System.Drawing.Point(7, 365);
this.btnConfiguration.Name = "btnConfiguration"; this.btnConfiguration.Name = "btnConfiguration";
this.btnConfiguration.Size = new System.Drawing.Size(152, 40); this.btnConfiguration.Size = new System.Drawing.Size(152, 40);
this.btnConfiguration.TabIndex = 14; this.btnConfiguration.TabIndex = 14;
@@ -121,7 +123,7 @@
// btnCalender // btnCalender
// //
this.btnCalender.Enabled = false; this.btnCalender.Enabled = false;
this.btnCalender.Location = new System.Drawing.Point(5, 322); this.btnCalender.Location = new System.Drawing.Point(3, 366);
this.btnCalender.Name = "btnCalender"; this.btnCalender.Name = "btnCalender";
this.btnCalender.Size = new System.Drawing.Size(151, 39); this.btnCalender.Size = new System.Drawing.Size(151, 39);
this.btnCalender.TabIndex = 13; this.btnCalender.TabIndex = 13;
@@ -324,6 +326,16 @@
this.btnLegacyTestApp.UseVisualStyleBackColor = true; this.btnLegacyTestApp.UseVisualStyleBackColor = true;
this.btnLegacyTestApp.Click += new System.EventHandler(this.btnLegacyTestApp_Click); this.btnLegacyTestApp.Click += new System.EventHandler(this.btnLegacyTestApp_Click);
// //
// button4
//
this.button4.Location = new System.Drawing.Point(7, 321);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(151, 39);
this.button4.TabIndex = 18;
this.button4.Text = "LUT Managment";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// FrmMainForm // FrmMainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -373,6 +385,7 @@
private System.Windows.Forms.Button btnLutUpdate; private System.Windows.Forms.Button btnLutUpdate;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
} }
} }
+8
View File
@@ -374,5 +374,13 @@ namespace Xylem.Common.Ui.GenesisToolBox
{ {
} }
private void button4_Click(object sender, EventArgs e)
{
var form = new FrmLutManagement();
form.Show();
form.Closed += Form_Closed;
Hide();
}
} }
} }
@@ -77,6 +77,7 @@
<Compile Include="FwUpdateSafe.cs" /> <Compile Include="FwUpdateSafe.cs" />
<Compile Include="MeterRecovery\RecoverySettings.cs" /> <Compile Include="MeterRecovery\RecoverySettings.cs" />
<Compile Include="MeterRecovery\RecoveryRegisterItem.cs" /> <Compile Include="MeterRecovery\RecoveryRegisterItem.cs" />
<Compile Include="MeterRecovery\RegisterRecoveryAccess.cs" />
<Compile Include="PasswordContainer.cs" /> <Compile Include="PasswordContainer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReportTemplate.cs" /> <Compile Include="ReportTemplate.cs" />
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery;
namespace Xylem.ServiceFwUpdate.Common.FwUpdateSafe namespace Xylem.ServiceFwUpdate.Common.FwUpdateSafe
{ {
@@ -32,6 +33,14 @@ namespace Xylem.ServiceFwUpdate.Common.FwUpdateSafe
public bool IsCiritcal { get; set; } public bool IsCiritcal { get; set; }
/// <summary>
/// Condition when the register will be overridden
/// </summary>
public RegisterRecoveryAccess Access { get; set; }
} }
} }
@@ -8,22 +8,35 @@ namespace Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery
{ {
public class RecoverySettings public class RecoverySettings
{ {
/// <summary> /// <summary>
/// Null if check in not necessary if is an number check it agianst the pcbid from meter /// Null if check in not necessary if is an number check it agianst the pcbid from meter
/// </summary> /// </summary>
public int? PrecondidtionCheckPcbID { get; set; } public int? PcbID { get; set; }
/// <summary> /// <summary>
/// Null if check in not necessary if is an number check it agianst the radio FRQ /// Null if check in not necessary if is an number check it agianst the radio FRQ
/// </summary> /// </summary>
public int? PrecondidtionCheckRadioFrq { get; set; } public int? RadioFrequencyMhz { get; set; }
/// <summary> /// <summary>
/// Null till meter handels regions /// Null till meter handels regions
/// </summary> /// </summary>
public string PrecondidtionCheckRegion { get; set; } = null; public string Region { get; set; } = null;
/// <summary> /// <summary>
/// Null till meter handels regions /// Null till meter handels regions
/// </summary> /// </summary>
public string PrecondidtionCheckFlexnetVersion { get; set; } public string Release { get; set; }
/// <summary>
/// User name
/// </summary>
public string ApproverName { get; set; }
/// <summary>
///null means not approved
/// </summary>
public DateTimeOffset? ApprovalDate { get; set; }
/// <summary> /// <summary>
/// List of registers to recover /// List of registers to recover
/// </summary> /// </summary>
@@ -31,7 +44,7 @@ namespace Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery
public string GenerateFileName() public string GenerateFileName()
{ {
return $"{PrecondidtionCheckPcbID}_{PrecondidtionCheckRadioFrq}_{PrecondidtionCheckRegion}_{PrecondidtionCheckFlexnetVersion}.config"; return $"{PcbID}_{RadioFrequencyMhz}_{Region}_{Release}.config";
} }
} }
@@ -0,0 +1,10 @@
namespace Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery
{
public enum RegisterRecoveryAccess
{
SetAlways,
SetIfDefault,
SetIfZero
}
}