Merge branch 'main' of https://slm.sms-esaap.com/la_operations/laa_production
This commit is contained in:
commit
96c828cfb9
@ -155,7 +155,7 @@
|
||||
</site>
|
||||
<site name="MeterProcessState" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\LAA_PRODUCTION\Common\Service\MeterProcessState" />
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||
|
||||
@ -394,8 +394,8 @@ namespace Xylem.Common.Ui.CordonelPreadjustmentUi
|
||||
|
||||
private void WatchTmrOnTick(Object sender, EventArgs e)
|
||||
{
|
||||
var t = new Task(() => { RunWatchActions(); });
|
||||
t.Start();
|
||||
//var t = new Task(() => { RunWatchActions(); });
|
||||
//t.Start();
|
||||
}
|
||||
|
||||
internal void DisableTemperatureinput(bool v)
|
||||
|
||||
@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
@ -30,6 +31,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
|
||||
var listOfProcessTask = new List<Task>();
|
||||
pp.IsBusy = true;
|
||||
|
||||
MetersToProcess.ForEach(m => m.StartTempWatch());
|
||||
|
||||
foreach (var meterctl in MetersToProcess)
|
||||
{
|
||||
listOfProcessTask.Add(new Task<bool>(() =>
|
||||
@ -52,6 +56,8 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
Ok = WriteRegisterSafe(meterctl.Meter, $"Store calibration", Register.Genesisflow.StoreCalibration, 1, false);
|
||||
if (CheckAbort(Ok, meterctl)) { return Ok; }
|
||||
pp.DebugMessage($"Read out", meterctl.Slot, "CC");
|
||||
Thread.Sleep(1000);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -130,7 +136,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
meterctl.Meter.calibrationResult.AdditionalLogInfos["Amp. Test Mean value PATH 3"] = tempP.Trim();
|
||||
}
|
||||
meterctl.Meter.calibrationResult.Succesfull = !meterctl.Failed;
|
||||
|
||||
meterctl.Meter.WriteLog($"store CalibrationResults on server Succesfull: {meterctl.Meter.calibrationResult.Succesfull} ");
|
||||
var r = LocalWebRequest.PostRequestAsync($"{ServiceUrls.PostGenesisCalibrationResultUrl()}?PcbId={meterctl.Meter.PcbId}", ref code, ref exPost, 8000, meterctl.Meter.calibrationResult);
|
||||
if (!r)
|
||||
{
|
||||
|
||||
@ -74,7 +74,26 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
foreach (var meterctl in MetersToProcess)
|
||||
{
|
||||
meterctl.SetTemperature(avgTemp);
|
||||
|
||||
}
|
||||
pp.RequestTemperatur();
|
||||
while (!pp.PushedTestBenchTemp.HasValue)
|
||||
{
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
|
||||
foreach (var putTempIntoMeter in MetersToProcess)
|
||||
{
|
||||
if (Math.Abs(Convert.ToDecimal(pp.PushedTestBenchTemp.Value) - avgTemp) > (decimal)2.0)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Abweichung von SPS zu Flansch gößer als 2°C");
|
||||
}
|
||||
putTempIntoMeter.Meter.calibrationResult.AddAdditionalLog($"SPS Temp", Convert.ToDecimal(pp.PushedTestBenchTemp.Value).ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -681,7 +681,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
pathRaw = Path.GetFileName(pathRaw);
|
||||
|
||||
var tmpUrl = $"http://10.49.40.25/MeterProcessState/api/TestBench/SetMeterLogPathInfo?SerialNumber={SerialNumber}&TestRunId={testRunString}&BasePath={basePath}&MainLogName={pathMain}&LEDName={pathRaw}";
|
||||
Logger.Debug($"Request Url: { tmpUrl}");
|
||||
Logger.Debug($"Request Url: {tmpUrl}");
|
||||
//ToDO: Update to service URl
|
||||
LocalWebRequest.GetRequest(tmpUrl, 30000);
|
||||
|
||||
@ -817,8 +817,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msg = $"Slot:{Slot} - {Resources.StrErrorMsgComPort} { ex.Message}";
|
||||
Logger.Fatal(msg);
|
||||
var msg = $"Slot:{Slot} - {Resources.StrErrorMsgComPort} {ex.Message}";
|
||||
Logger.Fatal(msg);
|
||||
throw new ApplicationException(msg);
|
||||
}
|
||||
|
||||
@ -1451,7 +1451,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
try
|
||||
{
|
||||
var radioFrequencyRaw = ReadRegister(Register.Sensusradio.FrequencyIndicator);
|
||||
if (radioFrequencyRaw != null &&
|
||||
if (radioFrequencyRaw != null &&
|
||||
RegisterConverter.ByteArrayToValue<Int32>(radioFrequencyRaw) != 0)
|
||||
{
|
||||
Region = "EMEA";
|
||||
@ -2306,59 +2306,69 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
Logger.Trace($"Slot:{Slot} - Start to dispose");
|
||||
|
||||
|
||||
LogRawData(false);
|
||||
LogManager.Flush();
|
||||
//isPart of Logout
|
||||
//StopKeepSession();
|
||||
|
||||
//Cancel receive tokens
|
||||
_keepSessionToken?.Cancel();
|
||||
|
||||
try
|
||||
{
|
||||
//todo only from Bench
|
||||
//WriteRegister<Byte>(Register.Genesisflow.SampleRate, 2, checkRegister: true);
|
||||
//WriteRegister(Register.Genesisflow.LedMode, 0, checkRegister: true);
|
||||
//Logout();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
|
||||
//Run thread again to notice CancellationToken has changed
|
||||
_onSyncKeepSessionThread?.Set();
|
||||
Logger.Trace($"Slot:{Slot} - Start to dispose");
|
||||
|
||||
//this timeout counter is being used for dispose only
|
||||
var timeoutCounter = 100;
|
||||
if (_keepSessionThread != null)
|
||||
{
|
||||
while (_keepSessionThread.ThreadState != ThreadState.Stopped && timeoutCounter > 0)
|
||||
|
||||
LogRawData(false);
|
||||
LogManager.Flush();
|
||||
//isPart of Logout
|
||||
//StopKeepSession();
|
||||
|
||||
//Cancel receive tokens
|
||||
_keepSessionToken?.Cancel();
|
||||
|
||||
try
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
timeoutCounter -= 1;
|
||||
//todo only from Bench
|
||||
//WriteRegister<Byte>(Register.Genesisflow.SampleRate, 2, checkRegister: true);
|
||||
//WriteRegister(Register.Genesisflow.LedMode, 0, checkRegister: true);
|
||||
//Logout();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (_keepSessionThread.ThreadState != ThreadState.Stopped)
|
||||
|
||||
//Run thread again to notice CancellationToken has changed
|
||||
_onSyncKeepSessionThread?.Set();
|
||||
|
||||
//this timeout counter is being used for dispose only
|
||||
var timeoutCounter = 100;
|
||||
if (_keepSessionThread != null)
|
||||
{
|
||||
//if thread is still running try to abort
|
||||
// try to avoid abort (takes age to run and is not safe)
|
||||
_keepSessionThread.Abort();
|
||||
while (_keepSessionThread.ThreadState != ThreadState.Stopped && timeoutCounter > 0)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
timeoutCounter -= 1;
|
||||
}
|
||||
|
||||
if (_keepSessionThread.ThreadState != ThreadState.Stopped)
|
||||
{
|
||||
//if thread is still running try to abort
|
||||
// try to avoid abort (takes age to run and is not safe)
|
||||
_keepSessionThread.Abort();
|
||||
}
|
||||
}
|
||||
|
||||
_keepSessionThread = null;
|
||||
|
||||
RequestPort?.Dispose();
|
||||
StreamingPort?.Dispose();
|
||||
|
||||
RequestProtocol?.Dispose();
|
||||
StreamingProtocol?.Dispose();
|
||||
Logger.Trace($"Slot:{Slot} - Dispose is finished");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
_keepSessionThread = null;
|
||||
|
||||
RequestPort?.Dispose();
|
||||
StreamingPort?.Dispose();
|
||||
|
||||
RequestProtocol?.Dispose();
|
||||
StreamingProtocol?.Dispose();
|
||||
Logger.Trace($"Slot:{Slot} - Dispose is finished");
|
||||
Logger.Trace($"Slot:{Slot} -dispose exception {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1 +1 @@
|
||||
8cb55c312de586b683d72cf58c13e2801d10e14b767777d98338d3e1473a1213
|
||||
e5e0833ba33456b07a9a7533c01344837e98dad9
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit e7aa3e2723a435f0a714df661dc5d86dfd45a71c
|
||||
Subproject commit 69bb567543b02e71b246a70e7b0aa255f4fda529
|
||||
@ -671,7 +671,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
|
||||
if (CheckPcbId.HasValue)
|
||||
{
|
||||
|
||||
var SkipRadioCheck = true;
|
||||
var SkipRadioCheck = false;
|
||||
sb = new StringBuilder();
|
||||
|
||||
|
||||
@ -1273,7 +1273,68 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("CalibrationResultsFromRun/{CalibrationResultId}")]
|
||||
public IHttpActionResult CalibrationResultsFromRun(int CalibrationResultId)
|
||||
{
|
||||
var result = SqlConnection
|
||||
.CreateSqlConnection(GlobalConfig.ConnectionString.Value)
|
||||
.CreateCommand($@"
|
||||
SELECT TOP 1
|
||||
ID
|
||||
, PcbId
|
||||
, CalFactor1
|
||||
, CalFactor2
|
||||
, CalFactor3
|
||||
, ZeroOffset1
|
||||
, ZeroOffset2
|
||||
, ZeroOffset3
|
||||
, FirstHitUpdatePeriod
|
||||
, FirstHitShift
|
||||
, FirstHitPercent1
|
||||
, FirstHitPercent2
|
||||
, FirstHitPercent3
|
||||
, ToFTempOffset1
|
||||
, ToFTempOffset2
|
||||
, ToFTempOffset3
|
||||
, MeterSize
|
||||
, date
|
||||
, successful
|
||||
FROM CordonelMeterCalibrationResults
|
||||
WHERE successful = 1
|
||||
AND ID = @{nameof(CalibrationResultId)}
|
||||
ORDER BY date DESC")
|
||||
.SetParameter(nameof(CalibrationResultId), CalibrationResultId)
|
||||
.FirstOrDefault(x => new CalibrationResults
|
||||
{
|
||||
Id = x.GetValue<Int32>(0),
|
||||
PcbId = x.GetValue<String>(1),
|
||||
CalFactor1 = x.GetValue<UInt16>(2),
|
||||
CalFactor2 = x.GetValue<UInt16>(3),
|
||||
CalFactor3 = x.GetValue<UInt16>(4),
|
||||
ZeroOffset1 = x.GetValue<Int32>(5),
|
||||
ZeroOffset2 = x.GetValue<Int32>(6),
|
||||
ZeroOffset3 = x.GetValue<Int32>(7),
|
||||
FirstHitUpdatePeriod = x.GetValue<Byte>(8),
|
||||
FirstHitShift = x.GetValue<Byte>(9),
|
||||
FirstHitPercent1 = x.GetValue<Byte>(10),
|
||||
FirstHitPercent2 = x.GetValue<Byte>(11),
|
||||
FirstHitPercent3 = x.GetValue<Byte>(12),
|
||||
ToFTempOffset1 = x.GetValue<Int32>(13),
|
||||
ToFTempOffset2 = x.GetValue<Int32>(14),
|
||||
ToFTempOffset3 = x.GetValue<Int32>(15),
|
||||
MeterSize = x.GetValue<Byte>(16),
|
||||
Date = x.GetValue<DateTime>(17),
|
||||
Succeeded = x.GetValue<Boolean>(18),
|
||||
});
|
||||
|
||||
if (result is null)
|
||||
{
|
||||
return this.NotFound();
|
||||
}
|
||||
|
||||
return this.Json(result);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("CalibrationResults/{pcbId}")]
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xylem.Common.Service.MeterProcessState</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.Service.MeterProcessState</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
@ -39,6 +39,7 @@
|
||||
<DocumentationFile>bin\Xylem.Common.Service.MeterProcessState.xml</DocumentationFile>
|
||||
<NoWarn>IDE0003;IDE0049;CS1591;</NoWarn>
|
||||
<FilesToIncludeForPublish>OnlyFilesToRunTheApp</FilesToIncludeForPublish>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@ -48,6 +49,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7</LangVersion>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
@ -497,6 +499,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -507,6 +510,7 @@
|
||||
<LangVersion>7</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
@ -517,6 +521,7 @@
|
||||
<LangVersion>7</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '_MANUAL_CONTROL|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -527,6 +532,7 @@
|
||||
<LangVersion>7.0</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
@ -539,9 +545,11 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|AnyCPU'">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<NameOfLastUsedPublishProfile>a</NameOfLastUsedPublishProfile>
|
||||
<NameOfLastUsedPublishProfile>C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState\Properties\PublishProfiles\a.pubxml</NameOfLastUsedPublishProfile>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<Use64BitIISExpress />
|
||||
<IISExpressSSLPort />
|
||||
|
||||
@ -44,17 +44,18 @@
|
||||
this.probarBussy = new System.Windows.Forms.ProgressBar();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.btnReadFwVersions = new System.Windows.Forms.Button();
|
||||
this.btn_MultiReadWrite = new System.Windows.Forms.Button();
|
||||
this.btn_CalibrationRestore = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.btnStoreAll = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.btnBatLife = new System.Windows.Forms.Button();
|
||||
this.btnRadioPressure = new System.Windows.Forms.Button();
|
||||
this.nundCalResultID = new System.Windows.Forms.NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)(this.registerGridView)).BeginInit();
|
||||
this.pnlBussy.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nundCalResultID)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cbComSlot
|
||||
@ -78,7 +79,7 @@
|
||||
//
|
||||
// btnRead
|
||||
//
|
||||
this.btnRead.Location = new System.Drawing.Point(205, 48);
|
||||
this.btnRead.Location = new System.Drawing.Point(189, 48);
|
||||
this.btnRead.Name = "btnRead";
|
||||
this.btnRead.Size = new System.Drawing.Size(185, 30);
|
||||
this.btnRead.TabIndex = 2;
|
||||
@ -103,7 +104,7 @@
|
||||
//
|
||||
// btnConnect
|
||||
//
|
||||
this.btnConnect.Location = new System.Drawing.Point(214, 12);
|
||||
this.btnConnect.Location = new System.Drawing.Point(189, 12);
|
||||
this.btnConnect.Name = "btnConnect";
|
||||
this.btnConnect.Size = new System.Drawing.Size(85, 30);
|
||||
this.btnConnect.TabIndex = 4;
|
||||
@ -127,9 +128,9 @@
|
||||
//
|
||||
// btnGetPCbID
|
||||
//
|
||||
this.btnGetPCbID.Location = new System.Drawing.Point(305, 12);
|
||||
this.btnGetPCbID.Location = new System.Drawing.Point(280, 12);
|
||||
this.btnGetPCbID.Name = "btnGetPCbID";
|
||||
this.btnGetPCbID.Size = new System.Drawing.Size(85, 30);
|
||||
this.btnGetPCbID.Size = new System.Drawing.Size(94, 30);
|
||||
this.btnGetPCbID.TabIndex = 11;
|
||||
this.btnGetPCbID.Text = "Get PCB ID";
|
||||
this.btnGetPCbID.UseVisualStyleBackColor = true;
|
||||
@ -196,7 +197,7 @@
|
||||
//
|
||||
// btnReadFwVersions
|
||||
//
|
||||
this.btnReadFwVersions.Location = new System.Drawing.Point(396, 12);
|
||||
this.btnReadFwVersions.Location = new System.Drawing.Point(380, 12);
|
||||
this.btnReadFwVersions.Name = "btnReadFwVersions";
|
||||
this.btnReadFwVersions.Size = new System.Drawing.Size(114, 30);
|
||||
this.btnReadFwVersions.TabIndex = 52;
|
||||
@ -204,19 +205,19 @@
|
||||
this.btnReadFwVersions.UseVisualStyleBackColor = true;
|
||||
this.btnReadFwVersions.Click += new System.EventHandler(this.btnReadFwVersions_Click);
|
||||
//
|
||||
// btn_MultiReadWrite
|
||||
// btn_CalibrationRestore
|
||||
//
|
||||
this.btn_MultiReadWrite.Location = new System.Drawing.Point(516, 12);
|
||||
this.btn_MultiReadWrite.Name = "btn_MultiReadWrite";
|
||||
this.btn_MultiReadWrite.Size = new System.Drawing.Size(110, 30);
|
||||
this.btn_MultiReadWrite.TabIndex = 58;
|
||||
this.btn_MultiReadWrite.Text = "MultiReadWrite";
|
||||
this.btn_MultiReadWrite.UseVisualStyleBackColor = true;
|
||||
this.btn_MultiReadWrite.Click += new System.EventHandler(this.btn_MultiReadWrite_Click);
|
||||
this.btn_CalibrationRestore.Location = new System.Drawing.Point(516, 12);
|
||||
this.btn_CalibrationRestore.Name = "btn_CalibrationRestore";
|
||||
this.btn_CalibrationRestore.Size = new System.Drawing.Size(114, 30);
|
||||
this.btn_CalibrationRestore.TabIndex = 58;
|
||||
this.btn_CalibrationRestore.Text = "CalibrationRestore";
|
||||
this.btn_CalibrationRestore.UseVisualStyleBackColor = true;
|
||||
this.btn_CalibrationRestore.Click += new System.EventHandler(this.btn_CalibrationRestore_Click);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(396, 48);
|
||||
this.button1.Location = new System.Drawing.Point(380, 48);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(114, 30);
|
||||
this.button1.TabIndex = 60;
|
||||
@ -226,7 +227,7 @@
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(516, 46);
|
||||
this.button2.Location = new System.Drawing.Point(516, 80);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(114, 30);
|
||||
this.button2.TabIndex = 61;
|
||||
@ -259,16 +260,6 @@
|
||||
this.timer1.Interval = 5000;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.Location = new System.Drawing.Point(516, 80);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(110, 30);
|
||||
this.button6.TabIndex = 68;
|
||||
this.button6.Text = "Seal Display Test";
|
||||
this.button6.UseVisualStyleBackColor = true;
|
||||
this.button6.Click += new System.EventHandler(this.button6_Click);
|
||||
//
|
||||
// btnBatLife
|
||||
//
|
||||
this.btnBatLife.Location = new System.Drawing.Point(516, 116);
|
||||
@ -289,19 +280,31 @@
|
||||
this.btnRadioPressure.UseVisualStyleBackColor = true;
|
||||
this.btnRadioPressure.Click += new System.EventHandler(this.btnRadioPressure_Click);
|
||||
//
|
||||
// nundCalResultID
|
||||
//
|
||||
this.nundCalResultID.Location = new System.Drawing.Point(516, 47);
|
||||
this.nundCalResultID.Maximum = new decimal(new int[] {
|
||||
999999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nundCalResultID.Name = "nundCalResultID";
|
||||
this.nundCalResultID.Size = new System.Drawing.Size(114, 20);
|
||||
this.nundCalResultID.TabIndex = 73;
|
||||
//
|
||||
// FrmRegisterStore
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(695, 553);
|
||||
this.Controls.Add(this.nundCalResultID);
|
||||
this.Controls.Add(this.btnRadioPressure);
|
||||
this.Controls.Add(this.btnBatLife);
|
||||
this.Controls.Add(this.button6);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.btnStoreAll);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.btn_MultiReadWrite);
|
||||
this.Controls.Add(this.btn_CalibrationRestore);
|
||||
this.Controls.Add(this.btnReadFwVersions);
|
||||
this.Controls.Add(this.pnlBussy);
|
||||
this.Controls.Add(this.btnGetPCbID);
|
||||
@ -318,6 +321,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.registerGridView)).EndInit();
|
||||
this.pnlBussy.ResumeLayout(false);
|
||||
this.pnlBussy.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nundCalResultID)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -339,14 +343,14 @@
|
||||
private System.Windows.Forms.ProgressBar probarBussy;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button btnReadFwVersions;
|
||||
private System.Windows.Forms.Button btn_MultiReadWrite;
|
||||
private System.Windows.Forms.Button btn_CalibrationRestore;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button btnStoreAll;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Button button6;
|
||||
private System.Windows.Forms.Button btnBatLife;
|
||||
private System.Windows.Forms.Button btnRadioPressure;
|
||||
private System.Windows.Forms.NumericUpDown nundCalResultID;
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@ -27,6 +28,7 @@ using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
using Xylem.Common.Logic.ServiceCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
using Xylem.Common.Utils.Logging;
|
||||
using XylemCommonUiLegacyGenCtl;
|
||||
using static Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.GenesisMeter;
|
||||
using Access = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Access;
|
||||
|
||||
@ -1568,12 +1570,6 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
private void btn_MultiReadWrite_Click(Object sender, EventArgs e)
|
||||
{
|
||||
if (_currentGenesis != null && _currentGenesis.IsLoggedOn)
|
||||
{
|
||||
var frmDialog = new FrmMultiWrite(_currentGenesis, _currentGenesis.GetRegistersDic());
|
||||
|
||||
frmDialog.ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1969,7 +1965,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
Thread.Sleep(5000);
|
||||
if (!_currentGenesis.Login())
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
_currentGenesis.WriteRegister("SYSTEM_ExitReason", 21, true, false);
|
||||
@ -2072,7 +2068,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2142,14 +2138,14 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
//CUSTOMER_AlarmVisualMask - 00-00-1F-DC
|
||||
//
|
||||
|
||||
Meter.WriteRegister("SENSUSRADIO_MainAlarmMask", new Byte[] { 0x00 }, true);
|
||||
Meter.WriteRegister("SENSUSRADIO_ExtendedAlarmMask", new Byte[] { 0x00 }, true);
|
||||
Meter.WriteRegister("SENSUSRADIO_MainAlarmMask", new Byte[] { 0x00 }, true);
|
||||
Meter.WriteRegister("SENSUSRADIO_ExtendedAlarmMask", new Byte[] { 0x00 }, true);
|
||||
|
||||
Meter.WriteRegister("CUSTOMER_AlarmEnableMask", new Byte[] { 0xD3, 0x9F, 0x00, 0x00 }, true);
|
||||
Meter.WriteRegister("CUSTOMER_AlarmBroadcastMask", new Byte[] { 0xDC, 0x1F, 0x00, 0x00 }, true);
|
||||
Meter.WriteRegister("CUSTOMER_AlarmVisualMask", new Byte[] { 0xDC, 0x1F, 0x00, 0x00 }, true);
|
||||
|
||||
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF,true);
|
||||
|
||||
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF, true);
|
||||
Meter.Logout();
|
||||
Thread.Sleep(5000);
|
||||
if (!Meter.Login())
|
||||
@ -2157,7 +2153,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
Thread.Sleep(5000);
|
||||
if (!Meter.Login())
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2196,5 +2192,73 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btn_CalibrationRestore_Click(Object sender, EventArgs e)
|
||||
{
|
||||
string err;
|
||||
foreach (var me in _meterBatch.ListOfMeters)
|
||||
{
|
||||
if (me is GenesisMeter Meter)
|
||||
{
|
||||
if (((GenesisMeter)me).IsLoggedOn)
|
||||
{
|
||||
var meterCalibrations = new CalibrationResults();
|
||||
if (!GetCalibrationResultsFromDbperRun(_currentPcbId, meterCalibrations, out err))
|
||||
{
|
||||
MessageBox.Show(err);
|
||||
}
|
||||
else
|
||||
{
|
||||
Meter.WriteRegister(Register.Genesisflow.FirstHitPercent1, meterCalibrations.FirstHitPercent1, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.FirstHitPercent2, meterCalibrations.FirstHitPercent2, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.FirstHitPercent3, meterCalibrations.FirstHitPercent3, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.FirstHitShift, meterCalibrations.FirstHitShift, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.FirstHitUpdatePeriod, meterCalibrations.FirstHitUpdatePeriod, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.ToFTempOffset1, meterCalibrations.ToFTempOffset1, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.ToFTempOffset2, meterCalibrations.ToFTempOffset2, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.ToFTempOffset3, meterCalibrations.ToFTempOffset3, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.ZeroOffset1, meterCalibrations.ZeroOffset1, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.ZeroOffset2, meterCalibrations.ZeroOffset2, true);
|
||||
Meter.WriteRegister(Register.Genesisflow.ZeroOffset3, meterCalibrations.ZeroOffset3, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean GetCalibrationResultsFromDbperRun(int RunId, CalibrationResults calibResults,
|
||||
out String errorMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
if (null == calibResults || string.IsNullOrEmpty(RunId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var url = "http://sla12iis01.emea.sensus.net/MeterProcessState/api/FinalCheck/CalibrationResults/";
|
||||
var requestResponse = LocalWebRequest.GetRequest(url, 30000, out var httpStatus);
|
||||
if (httpStatus == HttpStatusCode.OK && !string.IsNullOrEmpty(requestResponse))
|
||||
{
|
||||
var calibRes = JsonConvert.DeserializeObject<CalibrationResults>(requestResponse);
|
||||
// ClassAccess.CopyProperties(calibResults, calibRes);
|
||||
var type = typeof(CalibrationResults);
|
||||
foreach (var prop in type.GetProperties())
|
||||
{
|
||||
if (prop.CanWrite)
|
||||
prop.SetValue(calibResults, prop.GetValue(calibRes, null), null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
errorMsg = e.Message;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user