common/Ui/LegacyGenesisControl/TestSettingEditor.cs
2026-04-23 17:50:07 +02:00

130 lines
6.1 KiB
C#

using CordonelPreadjustmentUi;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.SoftwareAccessHelper;
using XylemCommonUiLegacyGenCtl.DataPackage;
using XylemCommonUiLegacyGenCtl.Enums;
namespace XylemCommonUiLegacyGenCtl
{
public partial class TestSettingEditor : UserControl
{
public PreAdjustmentSettingsContainer preAdjustmentSettings { get; set; }
public TestSetupContainer mainSettingContainer { get; set; }
public TestSettingEditor()
{
InitializeComponent();
}
private void TestSettingEditor_Load(Object sender, EventArgs e)
{
}
public ITstCont getMainSettingContainer()
{
return (ITstCont)mainSettingContainer;
}
public void SetContainer(ITstCont tstCont)
{
if (tstCont.GetContainer() is TestSetupContainer setTestContainer)
{
mainSettingContainer = setTestContainer;
showContainer();
}
}
private void showContainer()
{
cbProductionMode.Checked = mainSettingContainer.ProductionMode;
cbMainAllChanelsRequired.Checked = mainSettingContainer.AllChanelsRequired;
cbMainWatingForDecision.Checked = mainSettingContainer.WatingForDecision;
lblTestRunNr.Text = mainSettingContainer.TestRunNumber.ToString();
nudMainDelayInSBeforStart.Value = mainSettingContainer.DelayInSBeforStart;
cbMetersize.Items.Clear();
foreach (MeterSize size in (MeterSize[])Enum.GetValues(typeof(MeterSize)))
{
cbMetersize.Items.Add(size);
}
var setM = MeterSize.DN50;
if (mainSettingContainer.MeterSize != null)
{
setM = mainSettingContainer.MeterSize;
}
cbMetersize.SelectedItem = setM;
cbTempSource.Items.Clear();
foreach (TempSouceType size in (TempSouceType[])Enum.GetValues(typeof(TempSouceType)))
{
cbTempSource.Items.Add(size);
}
var setT = TempSouceType.ManualInput;
if (mainSettingContainer.TempSouce != null)
{
setT = mainSettingContainer.TempSouce;
}
cbTempSource.SelectedItem = setT;
mainSettingContainer.PreAdjustmentSettingsContainer = new PreAdjustmentSettingsContainer();
var r = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetMetersizeProgrammingData?MeterSize={mainSettingContainer.MeterSize.GetHashCode()}", 2000);
var dt = JsonConvert.DeserializeObject<Dictionary<string, UInt32>>(r);
foreach (var item in dt)
{
dataGridView2.Rows.Add(new object[] { item.Key, item.Value });
}
//private System.Windows.Forms.DataGridView dataGridView1;
//private System.Windows.Forms.DataGridViewTextBoxColumn gdMainSlot;
//private System.Windows.Forms.DataGridViewTextBoxColumn gdMainSerialNr;
//private System.Windows.Forms.DataGridViewCheckBoxColumn gdMainFlowtesting;
//private System.Windows.Forms.DataGridViewCheckBoxColumn gdMainPreajdustment;
//private System.Windows.Forms.DataGridViewCheckBoxColumn gdMainFlowAdjustment;
//private System.Windows.Forms.DataGridViewTextBoxColumn gdMainFlowAdjustmentTarget;
//private System.Windows.Forms.DataGridViewTextBoxColumn gdMainMeterType;
nUD_Settings_AmplitudeActivityCheckInterval.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_PercentageStop.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestPercentageStop;
nUD_PercentageStart.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestPercentageStart;
nUD_Settings_AmplitudeTestMinDistance.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestAmpTestDistance;
nUD_Settings_AmplitudeTestLowerLimit.Value = mainSettingContainer.PreAdjustmentSettingsContainer.OffsetTestLowerVoltageLimitMV;
nUD_Settings_AmplitudeTestUpperLimit.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_Samplerate.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_Preparation_StabiTime.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_ZeroflowOffsetTestActivityCheckInterval.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_ZeroflowOffsetTestNumberOfLines.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_ZeroflowOffsetTestSettlingTime.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_ZeroflowOffsetTestOffsetLimit.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_ZeroflowOffsetTestLowerLimit.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_Settings_ZeroflowOffsetTestUpperLimit.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_SettingsTempMonitorDeviation.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_SettingsTempMonitorLowerValue.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
nUD_SettingsTempMonitorUpperValue.Value = mainSettingContainer.PreAdjustmentSettingsContainer.AmpTestActivityCheckInverval;
}
}
}