Develop - GciBridge -> GCI -> PreadjustmentUI functions 6 - first successful processes - without CalibParams DB reader and CalibParams DB writer
This commit is contained in:
parent
a3bfc7a43e
commit
061e85ca6b
@ -1684,7 +1684,6 @@ namespace GenesisCordonelInterface.API
|
||||
{
|
||||
var ctl = new MeterStateControl(slot.Slot);
|
||||
|
||||
ctl.SetChecked(true);
|
||||
ctl.IsEnabled = true;
|
||||
|
||||
controls.Add(ctl);
|
||||
@ -2039,6 +2038,14 @@ namespace GenesisCordonelInterface.API
|
||||
}
|
||||
}
|
||||
|
||||
public bool PreAdjustment_PushTemperature(double temperature)
|
||||
{
|
||||
_progressProcess.PushedTestBenchTemp = temperature;
|
||||
_progressProcess.TempretureSelected = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates temperature calibration process instance based on current configuration.
|
||||
/// </summary>
|
||||
|
||||
@ -620,6 +620,12 @@ namespace GenesisCordonelInterface.API
|
||||
return _innerMeterAPI.PreAdjustment_TemperatureCalibrationAsync(slot, token);
|
||||
}
|
||||
|
||||
public bool PreAdjustment_PushTemperature(
|
||||
double temperature)
|
||||
{
|
||||
return _innerMeterAPI.PreAdjustment_PushTemperature(temperature);
|
||||
}
|
||||
|
||||
public Task<PreAdjustmentProcessResult> PreAdjustment_OffsetTestAsync(
|
||||
int slot,
|
||||
CancellationToken token = default)
|
||||
|
||||
@ -1665,6 +1665,33 @@ namespace TBF.Rig.BridgeComponents.GciBridge
|
||||
}
|
||||
}
|
||||
|
||||
public bool PreAdjustment_PushTemperature(
|
||||
double temperature)
|
||||
{
|
||||
const string operation = nameof(PreAdjustment_PushTemperature);
|
||||
|
||||
try
|
||||
{
|
||||
EnsureExternalInterface();
|
||||
|
||||
log.InfoFormat(
|
||||
"{0}: {1}. Temperature={2}",
|
||||
Name,
|
||||
operation,
|
||||
temperature);
|
||||
|
||||
return gciExternalInterface.PreAdjustment_PushTemperature(temperature);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Error(
|
||||
string.Format("{0}: {1} failed.", Name, operation),
|
||||
ex);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================================== PreAdjustment OFFSET TEST bridge ==================================
|
||||
|
||||
481
TBF/Rig/BridgeComponents/GciBridge/UI/Debug/MeterGridManager.cs
Normal file
481
TBF/Rig/BridgeComponents/GciBridge/UI/Debug/MeterGridManager.cs
Normal file
@ -0,0 +1,481 @@
|
||||
using Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using PublicModels = GenesisCordonelInterface.API.PublicModels;
|
||||
|
||||
namespace TBF.Rig.BridgeComponents.GciBridge.UI.Grid
|
||||
{
|
||||
public class MeterGridManager
|
||||
{
|
||||
private readonly DataGridView grid;
|
||||
|
||||
public MeterGridManager(DataGridView grid)
|
||||
{
|
||||
this.grid = grid ?? throw new ArgumentNullException(nameof(grid));
|
||||
EnableDoubleBuffering(grid);
|
||||
}
|
||||
|
||||
public void Init(List<string> comPorts)
|
||||
{
|
||||
grid.SuspendLayout();
|
||||
|
||||
try
|
||||
{
|
||||
grid.AutoGenerateColumns = false;
|
||||
grid.Columns.Clear();
|
||||
|
||||
grid.AllowUserToAddRows = false;
|
||||
grid.AllowUserToDeleteRows = false;
|
||||
grid.RowHeadersVisible = true;
|
||||
|
||||
CreateColumns(comPorts);
|
||||
ConfigureReadOnlyColumns();
|
||||
ConfigureSelection();
|
||||
}
|
||||
finally
|
||||
{
|
||||
grid.ResumeLayout();
|
||||
}
|
||||
|
||||
grid.Focus();
|
||||
grid.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText;
|
||||
}
|
||||
|
||||
private void CreateColumns(List<string> comPorts)
|
||||
{
|
||||
var configs = MeterGridConfigProvider
|
||||
.GetDefault()
|
||||
.OrderBy(x => x.DisplayIndex);
|
||||
|
||||
foreach (var config in configs)
|
||||
{
|
||||
DataGridViewColumn column;
|
||||
|
||||
switch (config.ColumnType)
|
||||
{
|
||||
case MeterGridConfigProvider.MeterGridColumnType.CheckBox:
|
||||
column = new DataGridViewCheckBoxColumn();
|
||||
break;
|
||||
|
||||
default:
|
||||
column = new DataGridViewTextBoxColumn();
|
||||
break;
|
||||
}
|
||||
|
||||
column.Name = config.Name;
|
||||
column.HeaderText = config.HeaderText;
|
||||
column.Width = config.Width;
|
||||
column.ReadOnly = config.ReadOnly;
|
||||
column.DisplayIndex = config.DisplayIndex;
|
||||
|
||||
grid.Columns.Add(column);
|
||||
}
|
||||
|
||||
grid.Columns.Add(CreateComPortColumn("RequestPort", "RequestPort", comPorts));
|
||||
grid.Columns.Add(CreateRequestPortTypeColumn());
|
||||
grid.Columns.Add(CreateComPortColumn("StreamingPort", "StreamingPort", comPorts));
|
||||
|
||||
grid.Columns.Add(CreateButtonColumn("DetectRequest", "DetectRequest", "..."));
|
||||
grid.Columns.Add(CreateButtonColumn("DetectStreaming", "DetectStreaming", "..."));
|
||||
}
|
||||
|
||||
private void ConfigureReadOnlyColumns()
|
||||
{
|
||||
foreach (DataGridViewColumn col in grid.Columns)
|
||||
{
|
||||
col.ReadOnly =
|
||||
col.Name != "Selected" &&
|
||||
col.Name != "RequestPort" &&
|
||||
col.Name != "RequestPortType" &&
|
||||
col.Name != "StreamingPort" &&
|
||||
col.Name != "DetectRequest" &&
|
||||
col.Name != "DetectStreaming";
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureSelection()
|
||||
{
|
||||
grid.MultiSelect = true;
|
||||
grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
|
||||
grid.CellContentClick -= Grid_CellContentClick;
|
||||
grid.CellContentClick += Grid_CellContentClick;
|
||||
|
||||
grid.CurrentCellDirtyStateChanged -= Grid_CurrentCellDirtyStateChanged;
|
||||
grid.CurrentCellDirtyStateChanged += Grid_CurrentCellDirtyStateChanged;
|
||||
}
|
||||
|
||||
public void UpdateComPortItems(List<string> comPorts)
|
||||
{
|
||||
UpdateComPortColumnItems("RequestPort", comPorts);
|
||||
UpdateComPortColumnItems("StreamingPort", comPorts);
|
||||
}
|
||||
|
||||
public void Update(List<PublicModels.MeterBatchDebugStatus> meters)
|
||||
{
|
||||
grid.SuspendLayout();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var meter in meters)
|
||||
{
|
||||
var row = FindOrCreateRow(meter.Slot);
|
||||
|
||||
SetCell(row, "Slot", meter.Slot);
|
||||
SetCell(row, "Selected", meter.Selected);
|
||||
SetCell(row, "PcbId", meter.PcbId);
|
||||
SetCell(row, "IsConnected", meter.IsConnected);
|
||||
SetCell(row, "IsLoggedOn", meter.IsLoggedOn);
|
||||
SetCell(row, "RequestPort", meter.RequestPort);
|
||||
SetCell(row, "RequestPortType", NormalizeRequestPortType(meter.RequestPortType));
|
||||
SetCell(row, "StreamingPort", meter.StreamingPort);
|
||||
SetCell(row, "FwVersion", meter.FwVersion);
|
||||
SetCell(row, "InterfaceVersion", meter.InterfaceVersion);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
grid.ResumeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateSlots(List<PublicModels.GciSlotInfo> slots)
|
||||
{
|
||||
grid.SuspendLayout();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var slot in slots)
|
||||
{
|
||||
var row = FindOrCreateRow(slot.SlotId);
|
||||
|
||||
SetCell(row, "Slot", slot.SlotId);
|
||||
SetCell(row, "PcbId", slot.PcbId);
|
||||
SetCell(row, "RequestPort", slot.RequestPort == null ? "" : slot.RequestPort.PortName);
|
||||
SetCell(row, "RequestPortType", MapRequestPortTypeBack(slot.RequestPort == null ? null : slot.RequestPort.Type));
|
||||
SetCell(row, "StreamingPort", slot.StreamingPort == null ? "" : slot.StreamingPort.PortName);
|
||||
SetCell(row, "IsConnected", false);
|
||||
SetCell(row, "IsLoggedOn", false);
|
||||
SetCell(row, "FwVersion", "");
|
||||
SetCell(row, "InterfaceVersion", "");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
grid.ResumeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddEmptySlotRow()
|
||||
{
|
||||
AddSlotRow(GetNextSlotId());
|
||||
}
|
||||
|
||||
public void AddSlotRow()
|
||||
{
|
||||
AddSlotRow(GetNextSlotId());
|
||||
}
|
||||
|
||||
public void AddSlotRow(int slotId)
|
||||
{
|
||||
if (ContainsSlot(slotId))
|
||||
throw new Exception($"Slot {slotId} already exists.");
|
||||
|
||||
int idx = grid.Rows.Add();
|
||||
var row = grid.Rows[idx];
|
||||
|
||||
SetCell(row, "Slot", slotId);
|
||||
SetCell(row, "Selected", false);
|
||||
SetCell(row, "RequestPort", "");
|
||||
SetCell(row, "RequestPortType", "IRDA");
|
||||
SetCell(row, "StreamingPort", "");
|
||||
SetCell(row, "PcbId", "");
|
||||
SetCell(row, "IsConnected", false);
|
||||
SetCell(row, "IsLoggedOn", false);
|
||||
SetCell(row, "FwVersion", "");
|
||||
SetCell(row, "InterfaceVersion", "");
|
||||
}
|
||||
|
||||
public List<PublicModels.MeterBatchDebugStatus> GetGridData()
|
||||
{
|
||||
var list = new List<PublicModels.MeterBatchDebugStatus>();
|
||||
|
||||
foreach (DataGridViewRow row in grid.Rows)
|
||||
{
|
||||
if (row.IsNewRow)
|
||||
continue;
|
||||
|
||||
if (row.Cells["Slot"].Value == null)
|
||||
continue;
|
||||
|
||||
list.Add(new PublicModels.MeterBatchDebugStatus
|
||||
{
|
||||
Slot = Convert.ToInt32(row.Cells["Slot"].Value),
|
||||
Selected = GetBool(row, "Selected"),
|
||||
PcbId = GetString(row, "PcbId"),
|
||||
IsConnected = GetBool(row, "IsConnected"),
|
||||
IsLoggedOn = GetBool(row, "IsLoggedOn"),
|
||||
RequestPort = GetString(row, "RequestPort"),
|
||||
RequestPortType = NormalizeRequestPortType(GetString(row, "RequestPortType")),
|
||||
StreamingPort = GetString(row, "StreamingPort"),
|
||||
FwVersion = GetString(row, "FwVersion"),
|
||||
InterfaceVersion = GetString(row, "InterfaceVersion")
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<PublicModels.MeterBatchDebugStatus> GetSelectedGridData()
|
||||
{
|
||||
return GetGridData()
|
||||
.Where(x => x.Selected)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public int GetSlotFromRow(int rowIndex)
|
||||
{
|
||||
if (rowIndex < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(rowIndex));
|
||||
|
||||
return Convert.ToInt32(grid.Rows[rowIndex].Cells["Slot"].Value);
|
||||
}
|
||||
|
||||
public string GetColumnName(int columnIndex)
|
||||
{
|
||||
return grid.Columns[columnIndex].Name;
|
||||
}
|
||||
|
||||
public void ClearSlots()
|
||||
{
|
||||
grid.Rows.Clear();
|
||||
}
|
||||
|
||||
public int GetNextSlotId()
|
||||
{
|
||||
var existingSlots = grid.Rows
|
||||
.Cast<DataGridViewRow>()
|
||||
.Where(r => !r.IsNewRow)
|
||||
.Where(r => r.Cells["Slot"].Value != null)
|
||||
.Select(r => Convert.ToInt32(r.Cells["Slot"].Value))
|
||||
.ToList();
|
||||
|
||||
if (existingSlots.Count == 0)
|
||||
return 1;
|
||||
|
||||
return existingSlots.Max() + 1;
|
||||
}
|
||||
|
||||
private bool ContainsSlot(int slotId)
|
||||
{
|
||||
return grid.Rows
|
||||
.Cast<DataGridViewRow>()
|
||||
.Any(r =>
|
||||
!r.IsNewRow &&
|
||||
r.Cells["Slot"].Value != null &&
|
||||
Convert.ToInt32(r.Cells["Slot"].Value) == slotId);
|
||||
}
|
||||
|
||||
private DataGridViewRow FindOrCreateRow(int slot)
|
||||
{
|
||||
foreach (DataGridViewRow row in grid.Rows)
|
||||
{
|
||||
if (!row.IsNewRow &&
|
||||
row.Cells["Slot"].Value != null &&
|
||||
Convert.ToInt32(row.Cells["Slot"].Value) == slot)
|
||||
{
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
int idx = grid.Rows.Add();
|
||||
var newRow = grid.Rows[idx];
|
||||
newRow.Cells["Slot"].Value = slot;
|
||||
return newRow;
|
||||
}
|
||||
|
||||
private void SetCell(DataGridViewRow row, string colName, object value)
|
||||
{
|
||||
if (!grid.Columns.Contains(colName))
|
||||
return;
|
||||
|
||||
if (value == null)
|
||||
value = "";
|
||||
|
||||
if (colName == "RequestPortType")
|
||||
value = NormalizeRequestPortType(Convert.ToString(value));
|
||||
|
||||
var cell = row.Cells[colName];
|
||||
|
||||
if (!Equals(cell.Value, value))
|
||||
cell.Value = value;
|
||||
}
|
||||
|
||||
private string GetString(DataGridViewRow row, string colName)
|
||||
{
|
||||
if (!grid.Columns.Contains(colName))
|
||||
return "";
|
||||
|
||||
return Convert.ToString(row.Cells[colName].Value);
|
||||
}
|
||||
|
||||
private bool GetBool(DataGridViewRow row, string colName)
|
||||
{
|
||||
if (!grid.Columns.Contains(colName))
|
||||
return false;
|
||||
|
||||
if (row.Cells[colName].Value == null)
|
||||
return false;
|
||||
|
||||
return Convert.ToBoolean(row.Cells[colName].Value);
|
||||
}
|
||||
|
||||
private DataGridViewComboBoxColumn CreateComPortColumn(
|
||||
string name,
|
||||
string headerText,
|
||||
List<string> comPorts)
|
||||
{
|
||||
return new DataGridViewComboBoxColumn
|
||||
{
|
||||
Name = name,
|
||||
HeaderText = headerText,
|
||||
DataSource = new List<string>(comPorts ?? new List<string>()),
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton
|
||||
};
|
||||
}
|
||||
|
||||
private DataGridViewComboBoxColumn CreateRequestPortTypeColumn()
|
||||
{
|
||||
return new DataGridViewComboBoxColumn
|
||||
{
|
||||
Name = "RequestPortType",
|
||||
HeaderText = "RequestPortType",
|
||||
DataSource = new List<string> { "", "IRDA", "UART", "RFID" },
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton
|
||||
};
|
||||
}
|
||||
|
||||
private DataGridViewButtonColumn CreateButtonColumn(
|
||||
string name,
|
||||
string headerText,
|
||||
string text)
|
||||
{
|
||||
return new DataGridViewButtonColumn
|
||||
{
|
||||
Name = name,
|
||||
HeaderText = headerText,
|
||||
Text = text,
|
||||
UseColumnTextForButtonValue = true
|
||||
};
|
||||
}
|
||||
|
||||
private void UpdateComPortColumnItems(string columnName, List<string> comPorts)
|
||||
{
|
||||
var col = grid.Columns[columnName] as DataGridViewComboBoxColumn;
|
||||
if (col == null)
|
||||
return;
|
||||
|
||||
col.DataSource = null;
|
||||
col.DataSource = new List<string>(comPorts ?? new List<string>());
|
||||
}
|
||||
|
||||
private string NormalizeRequestPortType(string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
return "";
|
||||
|
||||
string normalized = value.Trim();
|
||||
|
||||
if (normalized.Equals("RFID", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.IndexOf("RfidSerialPort", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
return "RFID";
|
||||
|
||||
if (normalized.Equals("UART", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.IndexOf("UartSerialPort", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
return "UART";
|
||||
|
||||
if (normalized.Equals("IRDA", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.Equals("IrDA", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.IndexOf("IrdaSerialPort", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
return "IRDA";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool RemoveSlot(int slotId)
|
||||
{
|
||||
grid.SuspendLayout();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (DataGridViewRow row in grid.Rows)
|
||||
{
|
||||
if (row.IsNewRow)
|
||||
continue;
|
||||
|
||||
if (row.Cells["Slot"].Value == null)
|
||||
continue;
|
||||
|
||||
if (Convert.ToInt32(row.Cells["Slot"].Value) == slotId)
|
||||
{
|
||||
grid.Rows.Remove(row);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
grid.ResumeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private string MapRequestPortTypeBack(string fullType)
|
||||
{
|
||||
return NormalizeRequestPortType(fullType);
|
||||
}
|
||||
|
||||
private void EnableDoubleBuffering(DataGridView dgv)
|
||||
{
|
||||
typeof(DataGridView)
|
||||
.GetProperty(
|
||||
"DoubleBuffered",
|
||||
BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
?.SetValue(dgv, true, null);
|
||||
}
|
||||
|
||||
private void Grid_CurrentCellDirtyStateChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (grid.IsCurrentCellDirty)
|
||||
{
|
||||
grid.CommitEdit(DataGridViewDataErrorContexts.Commit);
|
||||
}
|
||||
}
|
||||
|
||||
private void Grid_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex < 0)
|
||||
return;
|
||||
|
||||
if (grid.Columns[e.ColumnIndex].Name != "Selected")
|
||||
return;
|
||||
|
||||
bool clickedValue = Convert.ToBoolean(
|
||||
grid.Rows[e.RowIndex].Cells["Selected"].Value);
|
||||
|
||||
foreach (DataGridViewRow row in grid.SelectedRows)
|
||||
{
|
||||
if (row.Index == e.RowIndex)
|
||||
continue;
|
||||
|
||||
row.Cells["Selected"].Value = clickedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -24,6 +24,11 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.grpSlots = new System.Windows.Forms.GroupBox();
|
||||
this.pushTestBenchTempButton = new System.Windows.Forms.Button();
|
||||
this.pushedTestBenchTempTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.cb_Metersize = new System.Windows.Forms.ComboBox();
|
||||
this.l_SettingsPreparationMetersize = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
@ -40,13 +45,14 @@
|
||||
this.amplitudeTestActionButton = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.txtLog = new System.Windows.Forms.TextBox();
|
||||
this.cb_Metersize = new System.Windows.Forms.ComboBox();
|
||||
this.l_SettingsPreparationMetersize = new System.Windows.Forms.Label();
|
||||
this.grpSlots.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// grpSlots
|
||||
//
|
||||
this.grpSlots.Controls.Add(this.pushTestBenchTempButton);
|
||||
this.grpSlots.Controls.Add(this.pushedTestBenchTempTextBox);
|
||||
this.grpSlots.Controls.Add(this.label8);
|
||||
this.grpSlots.Controls.Add(this.cb_Metersize);
|
||||
this.grpSlots.Controls.Add(this.l_SettingsPreparationMetersize);
|
||||
this.grpSlots.Controls.Add(this.label7);
|
||||
@ -71,6 +77,50 @@
|
||||
this.grpSlots.Text = "Slots by selection in the table";
|
||||
this.grpSlots.Enter += new System.EventHandler(this.grpSlots_Enter);
|
||||
//
|
||||
// pushTestBenchTempButton
|
||||
//
|
||||
this.pushTestBenchTempButton.Location = new System.Drawing.Point(593, 186);
|
||||
this.pushTestBenchTempButton.Name = "pushTestBenchTempButton";
|
||||
this.pushTestBenchTempButton.Size = new System.Drawing.Size(81, 21);
|
||||
this.pushTestBenchTempButton.TabIndex = 121;
|
||||
this.pushTestBenchTempButton.Text = "Push temp";
|
||||
this.pushTestBenchTempButton.Click += new System.EventHandler(this.pushTestBenchTempButton_Click);
|
||||
//
|
||||
// pushedTestBenchTempTextBox
|
||||
//
|
||||
this.pushedTestBenchTempTextBox.Location = new System.Drawing.Point(550, 186);
|
||||
this.pushedTestBenchTempTextBox.Name = "pushedTestBenchTempTextBox";
|
||||
this.pushedTestBenchTempTextBox.Size = new System.Drawing.Size(37, 20);
|
||||
this.pushedTestBenchTempTextBox.TabIndex = 120;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(440, 189);
|
||||
this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(105, 13);
|
||||
this.label8.TabIndex = 118;
|
||||
this.label8.Text = "Pushed temperature:";
|
||||
//
|
||||
// cb_Metersize
|
||||
//
|
||||
this.cb_Metersize.FormattingEnabled = true;
|
||||
this.cb_Metersize.Location = new System.Drawing.Point(74, 30);
|
||||
this.cb_Metersize.Name = "cb_Metersize";
|
||||
this.cb_Metersize.Size = new System.Drawing.Size(73, 21);
|
||||
this.cb_Metersize.TabIndex = 117;
|
||||
//
|
||||
// l_SettingsPreparationMetersize
|
||||
//
|
||||
this.l_SettingsPreparationMetersize.AutoSize = true;
|
||||
this.l_SettingsPreparationMetersize.Location = new System.Drawing.Point(14, 36);
|
||||
this.l_SettingsPreparationMetersize.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_SettingsPreparationMetersize.Name = "l_SettingsPreparationMetersize";
|
||||
this.l_SettingsPreparationMetersize.Size = new System.Drawing.Size(55, 13);
|
||||
this.l_SettingsPreparationMetersize.TabIndex = 116;
|
||||
this.l_SettingsPreparationMetersize.Text = "Metersize:";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
@ -157,6 +207,7 @@
|
||||
this.completionActionButton.Size = new System.Drawing.Size(150, 28);
|
||||
this.completionActionButton.TabIndex = 3;
|
||||
this.completionActionButton.Text = "Completition";
|
||||
this.completionActionButton.Click += new System.EventHandler(this.completionActionButton_Click);
|
||||
//
|
||||
// offsetTestActionButton
|
||||
//
|
||||
@ -165,6 +216,7 @@
|
||||
this.offsetTestActionButton.Size = new System.Drawing.Size(150, 28);
|
||||
this.offsetTestActionButton.TabIndex = 5;
|
||||
this.offsetTestActionButton.Text = "Offset test";
|
||||
this.offsetTestActionButton.Click += new System.EventHandler(this.offsetTestActionButton_Click);
|
||||
//
|
||||
// preparationActionButton
|
||||
//
|
||||
@ -191,7 +243,7 @@
|
||||
this.temperatureCalibrationActionButton.Size = new System.Drawing.Size(150, 28);
|
||||
this.temperatureCalibrationActionButton.TabIndex = 2;
|
||||
this.temperatureCalibrationActionButton.Text = "Temperature calibration";
|
||||
this.temperatureCalibrationActionButton.Click += new System.EventHandler(this.amplitudeTestActionButton_Click);
|
||||
this.temperatureCalibrationActionButton.Click += new System.EventHandler(this.temperatureCalibrationActionButton_Click);
|
||||
//
|
||||
// amplitudeTestActionButton
|
||||
//
|
||||
@ -200,6 +252,7 @@
|
||||
this.amplitudeTestActionButton.Size = new System.Drawing.Size(150, 28);
|
||||
this.amplitudeTestActionButton.TabIndex = 18;
|
||||
this.amplitudeTestActionButton.Text = "Amplitude test";
|
||||
this.amplitudeTestActionButton.Click += new System.EventHandler(this.amplitudeTestActionButton_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
@ -225,24 +278,6 @@
|
||||
this.txtLog.TabIndex = 5;
|
||||
this.txtLog.WordWrap = false;
|
||||
//
|
||||
// cb_Metersize
|
||||
//
|
||||
this.cb_Metersize.FormattingEnabled = true;
|
||||
this.cb_Metersize.Location = new System.Drawing.Point(74, 30);
|
||||
this.cb_Metersize.Name = "cb_Metersize";
|
||||
this.cb_Metersize.Size = new System.Drawing.Size(73, 21);
|
||||
this.cb_Metersize.TabIndex = 117;
|
||||
//
|
||||
// l_SettingsPreparationMetersize
|
||||
//
|
||||
this.l_SettingsPreparationMetersize.AutoSize = true;
|
||||
this.l_SettingsPreparationMetersize.Location = new System.Drawing.Point(14, 36);
|
||||
this.l_SettingsPreparationMetersize.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.l_SettingsPreparationMetersize.Name = "l_SettingsPreparationMetersize";
|
||||
this.l_SettingsPreparationMetersize.Size = new System.Drawing.Size(55, 13);
|
||||
this.l_SettingsPreparationMetersize.TabIndex = 116;
|
||||
this.l_SettingsPreparationMetersize.Text = "Metersize:";
|
||||
//
|
||||
// PreadjustmentActionsView
|
||||
//
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
@ -271,5 +306,8 @@
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.ComboBox cb_Metersize;
|
||||
private System.Windows.Forms.Label l_SettingsPreparationMetersize;
|
||||
private System.Windows.Forms.Button pushTestBenchTempButton;
|
||||
private System.Windows.Forms.TextBox pushedTestBenchTempTextBox;
|
||||
private System.Windows.Forms.Label label8;
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,17 @@
|
||||
using CordonelPreadjustmentUi;
|
||||
using Common;
|
||||
using CordonelPreadjustmentUi;
|
||||
using CordonelPreadjustmentUi.Processes.Itinerary;
|
||||
using GenesisCordonelInterface.API;
|
||||
using GenesisCordonelInterface.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TBF.UiBridge;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
|
||||
using Xylem.Common.Ui.CordonelPreadjustmentUi;
|
||||
@ -25,6 +29,10 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
private readonly Action _addSlotAction;
|
||||
private readonly Action _saveAction;
|
||||
|
||||
public event EventHandler<EventArgsMeterSuccsessfull> OnAbort;
|
||||
|
||||
private readonly System.Windows.Forms.Timer _tempRequestTimer = new System.Windows.Forms.Timer();
|
||||
private bool _tempButtonHighlight;
|
||||
public PreadjustmentActionsView(
|
||||
MainView mainview,
|
||||
GciBridge bridge,
|
||||
@ -41,6 +49,10 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
|
||||
LoadRegisterComboBoxes();
|
||||
|
||||
InitGciHandlers();
|
||||
|
||||
//
|
||||
|
||||
cb_Metersize.Items.Clear();
|
||||
foreach (MeterSize size in (MeterSize[])Enum.GetValues(typeof(MeterSize)))
|
||||
{
|
||||
@ -52,6 +64,25 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
setM = _mainView._gciApi._innerMeterAPI._settings.MeterSize;
|
||||
}
|
||||
cb_Metersize.SelectedItem = setM;
|
||||
|
||||
//
|
||||
|
||||
_tempRequestTimer.Interval = 500;
|
||||
|
||||
_tempRequestTimer.Tick += (s, e) =>
|
||||
{
|
||||
_tempButtonHighlight = !_tempButtonHighlight;
|
||||
|
||||
pushTestBenchTempButton.BackColor =
|
||||
_tempButtonHighlight
|
||||
? Color.Red
|
||||
: SystemColors.Control;
|
||||
};
|
||||
}
|
||||
|
||||
private void InitGciHandlers()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void AddSlot()
|
||||
@ -73,7 +104,7 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
|
||||
if (slots.Count == 0)
|
||||
throw new Exception("No selected slots in grid.");
|
||||
|
||||
|
||||
return slots;
|
||||
}
|
||||
|
||||
@ -92,7 +123,8 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
_cts?.Cancel();
|
||||
OnAbort?.Invoke(null, new EventArgsMeterSuccsessfull(new List<int>()));//stop Laatzen
|
||||
_cts?.Cancel();//stop StaraTura
|
||||
Log("Cancel requested.");
|
||||
}
|
||||
|
||||
@ -147,11 +179,11 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
btnCancel.Enabled = busy;
|
||||
}
|
||||
|
||||
private void LogResult(string methodName, object result)
|
||||
/*private void LogResult(string methodName, object result)
|
||||
{
|
||||
Log(methodName + " result:");
|
||||
Log(result == null ? "<null>" : result.ToString());
|
||||
}
|
||||
}*/
|
||||
|
||||
private void Log(string message)
|
||||
{
|
||||
@ -162,6 +194,17 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
Environment.NewLine);
|
||||
}
|
||||
|
||||
private void Log(int slot, string message)
|
||||
{
|
||||
txtLog.AppendText(
|
||||
DateTime.Now.ToString("HH:mm:ss.fff") +
|
||||
" " +
|
||||
$"Slot: {slot}" +
|
||||
" - " +
|
||||
message +
|
||||
Environment.NewLine);
|
||||
}
|
||||
|
||||
private void LoadRegisterComboBoxes()
|
||||
{
|
||||
|
||||
@ -271,6 +314,13 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
token);
|
||||
});
|
||||
}
|
||||
private void pushTestBenchTempButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
_bridge.PreAdjustment_PushTemperature(Convert.ToDouble(pushedTestBenchTempTextBox.Text));
|
||||
|
||||
_tempRequestTimer.Stop();
|
||||
pushTestBenchTempButton.BackColor = SystemColors.Control;
|
||||
}
|
||||
|
||||
private void offsetTestActionButton_Click(
|
||||
object sender,
|
||||
@ -300,18 +350,48 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
|
||||
private ProcessProgress CreatePreparationProgress()
|
||||
{
|
||||
return new ProcessProgress
|
||||
ProcessProgress pp = new ProcessProgress
|
||||
{
|
||||
Setting = new PreAdjustmentSettingsContainer
|
||||
{
|
||||
|
||||
TempOnly = false,
|
||||
Culture = Thread.CurrentThread.CurrentCulture,
|
||||
MeterSize = (MeterSize)cb_Metersize.SelectedItem
|
||||
Culture = new CultureInfo("en-US"),
|
||||
MeterSize = (MeterSize)cb_Metersize.SelectedItem,
|
||||
OffsetTestSettlingTime = 0
|
||||
},
|
||||
|
||||
IsAutomaticMode = false
|
||||
IsAutomaticMode = false,
|
||||
};
|
||||
|
||||
pp.OnRequestTempretureSelection += RequestTempretureSelection;
|
||||
pp.OnDebugMessageChanged += DebugMessageChanged;
|
||||
|
||||
OnAbort += (o, args) =>
|
||||
{
|
||||
pp.StopSequence = true;
|
||||
pp.CancellationSource.Cancel();
|
||||
};
|
||||
|
||||
return pp;
|
||||
|
||||
}
|
||||
|
||||
private void DebugMessageChanged(object sender, EventArgsDebug e)
|
||||
{
|
||||
BeginInvoke(new Action(() =>
|
||||
{
|
||||
Log(e.Value);
|
||||
}));
|
||||
}
|
||||
|
||||
private void RequestTempretureSelection(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke(new Action(() =>
|
||||
{
|
||||
Log("Temperature requesting, please set actual value");
|
||||
|
||||
_tempRequestTimer.Start();
|
||||
}));
|
||||
}
|
||||
|
||||
private List<MeterStateControl> CreateMeterControls(IEnumerable<GciPublicModels.MeterBatchDebugStatus> slots)
|
||||
@ -332,27 +412,6 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
return controls;
|
||||
}
|
||||
|
||||
private PreAdjustmentSettingsContainer CreatePreAdjustmentSettings(IEnumerable<GciPublicModels.MeterBatchDebugStatus> slots)
|
||||
{
|
||||
var settings =
|
||||
new PreAdjustmentSettingsContainer();
|
||||
|
||||
settings.Meters =
|
||||
slots.Select(s => s.Slot).ToList();
|
||||
|
||||
settings.TempMeters =
|
||||
new List<int>();
|
||||
|
||||
settings.NumberOfPaths = 2;
|
||||
settings.TempOnly = false;
|
||||
settings.Culture =
|
||||
Thread.CurrentThread.CurrentCulture;
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void writeRegisterButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
/*ExecuteAsync(async token =>
|
||||
@ -421,8 +480,7 @@ namespace TBF.Rig.BridgeComponents.GciBridge.UI.StaraTuraAPI_GciBridge
|
||||
return;
|
||||
}
|
||||
|
||||
var pp =
|
||||
CreatePreparationProgress();
|
||||
var pp = CreatePreparationProgress();
|
||||
|
||||
foreach (var selectedSlot in selectedSlots)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user