123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.Util;
- using DocumentFormat.OpenXml;
- using DocumentFormat.OpenXml.Drawing;
- using DocumentFormat.OpenXml.Wordprocessing;
- using FurnaceGasPanelUI.Models;
- using MECF.Framework.Common;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.UI.Client.ClientBase;
- using MECF.Framework.UI.Core.Control;
- using MECF.Framework.UI.Core.ExtendedControls;
- using OpenSEMI.ClientBase;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.ServiceModel.Channels;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using MECF.Framework.UI.Core.DxfScript;
- using Aitex.Core.UI.Control;
- using DocumentFormat.OpenXml.Spreadsheet;
- using MECF.Framework.Common.Equipment;
- namespace FurnaceGasPanelUI.Views.Maintenances
- {
- public class GasXmlViewModel : ThermalGasPanelUIViewModelBase, MECF.Framework.Common.IUserFunctions
- {
- #region
- private string _PM = $"{ModuleName.PM1.ToString()}.";
- [Subscription("System.NameKeyDict")]
- public Dictionary<string, List<string>> NameKeyDict { get; set; }
- public Window WinOwner { get; set; }
- private GasPanelStateType _selectedGasStateType = GasPanelStateType.Monitor;
- public GasPanelStateType SelectedGasStateType
- {
- get
- {
- return _selectedGasStateType;
- }
- set
- {
- _selectedGasStateType = value;
- NotifyOfPropertyChange(nameof(SelectedGasStateType));
- }
- }
- #endregion
- public GasXmlViewModel()
- {
- UserFunctionsEvents.ClearAll();
- UserFunctionsEvents.RegisterEvent<Dictionary<string, object>>("SwichValue", SwichValue);
- UserFunctionsEvents.RegisterEvent<Dictionary<string, object>>("ValveTouchUp", ValveTouchUp);
- UserFunctionsEvents.RegisterEvent<Dictionary<string, object>>("MfcFlowTouchUp", MfcFlowTouchUp);
- }
- protected override void OnViewLoaded(object view)
- {
- base.OnViewLoaded(view);
- SwitchKey();
- }
- protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
- {
- base.InvokeAfterUpdateProperty(data);
- GasMapProvider.GasMap.ModifyDrag();
- }
- public void SelectedGasStateTypeCmd(string cmd)
- {
- switch (cmd)
- {
- case "Manual":
- SelectedGasStateType = GasPanelStateType.Manual;
- break;
- case "Monitor":
- SelectedGasStateType = GasPanelStateType.Monitor;
- break;
- case "Recipe":
- SelectedGasStateType = GasPanelStateType.Recipe;
- break;
- default:
- break;
- }
- SwitchKey(SelectedGasStateType == GasPanelStateType.Monitor);
- }
- /// <summary>
- /// 切换Key
- /// </summary>
- /// <param name="isMonitor"></param>
- public void SwitchKey(bool isMonitor = true)
- {
- foreach (var item in GasMapProvider.GasMap.Valves)
- {
- var realKey = $"{ModuleName.PM1.ToString()}.{item.Name}.Feedback";
- var recipeKey = $"{ModuleName.PM1.ToString()}.{item.Name}.VirtualStatus";
- item.Key = isMonitor ? realKey : recipeKey;
- }
- foreach (var item in GasMapProvider.GasMap.Buttons)
- {
- bool isExextue = item.BoolCondition != null;
- var realKey = $"{ModuleName.PM1}.{item.InnerText.Text}Enable";
- if (isExextue)
- {
- item.BoolCondition.Execute();
- realKey = item.BoolCondition.ReadBoolValue().Item1;
- }
- item.DataKey = isMonitor ? realKey : realKey;
- }
- foreach (var item in GasMapProvider.GasMap.Analogs)
- {
- item.Brush = GasMapProvider.InitMFCColor;
- var realKey = $"{ModuleName.PM1}.{item.Name}.Feedback";
- var recipeKey = $"{ModuleName.PM1}.{item.Name}.SetPoint";
- item.ValueKey = isMonitor ? realKey : recipeKey;
- }
- foreach (var item in GasMapProvider.GasMap.Circles)
- {
- bool isExextue = item.ClickCondition == null && item.BoolCondition != null && item.StringCondition == null;
- if (isExextue)
- {
- item.BoolCondition.Execute();
- item.Key = item.BoolCondition.ReadBoolValue().Item1;
- continue;
- }
- }
- }
- public void SetEnable(Dictionary<string, object> parameter)
- {
- }
- public void SwichValue(Dictionary<string, object> parameter)
- {
- }
- public void ValveTouchUp(Dictionary<string, object> parameter)
- {
- }
- public void MfcFlowTouchUp(Dictionary<string, object> parameter)
- {
- }
- }
- }
|