|
@@ -6,7 +6,9 @@ using System.Linq;
|
|
using System.Reflection;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
|
|
+using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
|
|
+using System.Windows.Shell;
|
|
using Aitex.Core.Common.DeviceData;
|
|
using Aitex.Core.Common.DeviceData;
|
|
using Aitex.Core.RT.IOCore;
|
|
using Aitex.Core.RT.IOCore;
|
|
using Aitex.Core.RT.Log;
|
|
using Aitex.Core.RT.Log;
|
|
@@ -19,6 +21,7 @@ using MECF.Framework.Common.CommonData.DeviceData;
|
|
using MECF.Framework.Common.DataCenter;
|
|
using MECF.Framework.Common.DataCenter;
|
|
using MECF.Framework.Common.Device;
|
|
using MECF.Framework.Common.Device;
|
|
using MECF.Framework.Common.OperationCenter;
|
|
using MECF.Framework.Common.OperationCenter;
|
|
|
|
+using MECF.Framework.UI.Client.CenterViews.Dialogs;
|
|
using OpenSEMI.ClientBase;
|
|
using OpenSEMI.ClientBase;
|
|
|
|
|
|
namespace FurnaceUI.Views.Maintenances
|
|
namespace FurnaceUI.Views.Maintenances
|
|
@@ -59,8 +62,7 @@ namespace FurnaceUI.Views.Maintenances
|
|
get => _powerOnVisibility;
|
|
get => _powerOnVisibility;
|
|
set => SetField(ref _powerOnVisibility, value, nameof(PowerOnVisibility));
|
|
set => SetField(ref _powerOnVisibility, value, nameof(PowerOnVisibility));
|
|
}
|
|
}
|
|
- Dictionary<string, FFUData> ffuDictionary = new Dictionary<string, FFUData>();
|
|
|
|
-
|
|
|
|
|
|
+
|
|
protected override void OnActivate()
|
|
protected override void OnActivate()
|
|
{
|
|
{
|
|
base.OnActivate();
|
|
base.OnActivate();
|
|
@@ -69,72 +71,42 @@ namespace FurnaceUI.Views.Maintenances
|
|
foreach (var item in FFUKeyDict)
|
|
foreach (var item in FFUKeyDict)
|
|
{
|
|
{
|
|
var deviceName = item.Split('.').ToList()[1];
|
|
var deviceName = item.Split('.').ToList()[1];
|
|
|
|
+ var ffuConfigData = QueryDataClient.Instance.Service.GetConfig($"FFU.{deviceName}.SetSpeed");
|
|
|
|
+
|
|
FFUDataList.Add(new FFUData()
|
|
FFUDataList.Add(new FFUData()
|
|
{
|
|
{
|
|
RTName = deviceName,
|
|
RTName = deviceName,
|
|
- DisplayName = deviceName,
|
|
|
|
|
|
+ Value = ffuConfigData.ToString(),
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- ffuDictionary = FFUDataList.ToDictionary(a => a.RTName);
|
|
|
|
}
|
|
}
|
|
protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
|
|
protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
|
|
{
|
|
{
|
|
base.InvokeAfterUpdateProperty(data);
|
|
base.InvokeAfterUpdateProperty(data);
|
|
- var values = QueryDataClient.Instance.Service.PollData(FFUKeyDict).Values.Select(a => (a as AITFFUData)).ToList();
|
|
|
|
- if (ffuDictionary != null)
|
|
|
|
|
|
+
|
|
|
|
+ if (FFUDataList != null && FFUDataList.Count > 0)
|
|
{
|
|
{
|
|
- foreach (var item in values)
|
|
|
|
|
|
+ var allFfuName = FFUDataList.Select(a => $"PM1.{a.RTName}.DeviceData").ToList();
|
|
|
|
+ var allRtData = QueryDataClient.Instance.Service.PollData(allFfuName);
|
|
|
|
+ foreach (var item in FFUDataList)
|
|
{
|
|
{
|
|
- if (item==null || !ffuDictionary.TryGetValue(item.RTName, out var ffu))
|
|
|
|
|
|
+ var rtItem = allRtData.FirstOrDefault(a => a.Key == $"PM1.{item.RTName}.DeviceData");
|
|
|
|
+ if (rtItem.Value == null)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- ffu.DisplayName = item.DisplayName;
|
|
|
|
- ffu.MaxValue = item.Max.ToString();
|
|
|
|
- ffu.MinValue = item.Min.ToString();
|
|
|
|
- ffu.ActualValue = item.Feedback;
|
|
|
|
- ffu.RTName = item.RTName;
|
|
|
|
- ffu.IsSwitch = item.IsSwitchOn;
|
|
|
|
- ffu.Value = item.SetPoint.ToString();
|
|
|
|
- ffu.LastSetValue = item.SetPoint;
|
|
|
|
|
|
+ item.DisplayName = ((AITFFUData)rtItem.Value).DisplayName;
|
|
|
|
+ item.ActualValue = ((AITFFUData)rtItem.Value).Feedback;
|
|
|
|
+ item.IsSwitch = ((AITFFUData)rtItem.Value).IsSwitchOn;
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- async void DelayData(string type, object sender, object item)
|
|
|
|
- {
|
|
|
|
- await WaitForResultsAsync();
|
|
|
|
- if (!string.IsNullOrEmpty(type) && item != null && sender != null)
|
|
|
|
- {
|
|
|
|
- var dataItem = item as FFUData;
|
|
|
|
- string value = ((TextBox)sender).Text;
|
|
|
|
- var setValue = double.Parse(value);
|
|
|
|
- var max = double.Parse(dataItem.MaxValue);
|
|
|
|
- var min = double.Parse(dataItem.MinValue);
|
|
|
|
|
|
|
|
- if (setValue != dataItem.LastSetValue)
|
|
|
|
- {
|
|
|
|
- //if (setValue < min || setValue > max)
|
|
|
|
- //{
|
|
|
|
- // DialogBox.ShowWarning($"{dataItem.DisplayName} setValue={setValue}, limit is ({min}, {max})");
|
|
|
|
- // return;
|
|
|
|
- //}
|
|
|
|
- InvokeClient.Instance.Service.DoOperation($"PM1.{dataItem.RTName}.SetCurrectSpeed", value);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- private async Task WaitForResultsAsync()
|
|
|
|
- {
|
|
|
|
- // Simulate waiting for results using a delay
|
|
|
|
- // In a real-world scenario, you might wait for an event or a specific condition
|
|
|
|
- await Task.Delay(10);
|
|
|
|
|
|
|
|
- // Here you can add logic to check if the results are ready
|
|
|
|
- // For example, polling or using a completion source
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
public void AllFFUPower(string value)
|
|
public void AllFFUPower(string value)
|
|
{
|
|
{
|
|
var setValue = bool.Parse(value);
|
|
var setValue = bool.Parse(value);
|
|
@@ -155,13 +127,76 @@ namespace FurnaceUI.Views.Maintenances
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- DelayData(type,sender,item);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
LOG.Write(ex);
|
|
LOG.Write(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void Save()
|
|
|
|
+ {
|
|
|
|
+ if (!DialogBox.Confirm("Are you sure Determine the speed parameters for FFU"))
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ foreach (var item in FFUDataList)
|
|
|
|
+ {
|
|
|
|
+ InvokeClient.Instance.Service.DoOperation($"PM1.{item.RTName}.SetCurrectSpeed", item.Value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ (GetView() as Window).Close();
|
|
|
|
+ }
|
|
|
|
+ public void Cancle()
|
|
|
|
+ {
|
|
|
|
+ (GetView() as Window).Close();
|
|
|
|
+ }
|
|
|
|
+ public void AllSetClick(object sender)
|
|
|
|
+ {
|
|
|
|
+ string stSetValue = ShowNumberKeyboard(sender as Button, "", 1);
|
|
|
|
+ var values = QueryDataClient.Instance.Service.PollData(FFUKeyDict).Values.Select(a => (a as AITFFUData)).ToList();
|
|
|
|
+
|
|
|
|
+ foreach (var item in FFUDataList)
|
|
|
|
+ {
|
|
|
|
+ var rtData = values.FirstOrDefault(a => a.RTName == item.RTName);
|
|
|
|
+ if (rtData == null)
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ item.Value = stSetValue;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private string ShowNumberKeyboard(Control control, string defaultValue, int keepDecimals = -1)
|
|
|
|
+ {
|
|
|
|
+ NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
|
|
|
|
+ numberKeyboard.KeepDecimals = keepDecimals;
|
|
|
|
+ var point = control.PointFromScreen(new Point(0, 0));
|
|
|
|
+ double wx = SystemParameters.WorkArea.Width;
|
|
|
|
+ double hy = SystemParameters.WorkArea.Height;
|
|
|
|
+ if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
|
|
|
|
+ {
|
|
|
|
+ numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
|
|
|
|
+ }
|
|
|
|
+ if (-point.X + numberKeyboard.Width < wx)
|
|
|
|
+ {
|
|
|
|
+ numberKeyboard.Left = -point.X;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
|
|
|
|
+ }
|
|
|
|
+ if ((bool)numberKeyboard.ShowDialog())
|
|
|
|
+ return numberKeyboard.ValueString;
|
|
|
|
+ else
|
|
|
|
+ return "Cancel";
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
public class FFUData : PropertyChangedBase
|
|
public class FFUData : PropertyChangedBase
|
|
{
|
|
{
|