Browse Source

revise vpw cell

chenzk 3 weeks ago
parent
commit
ab6b676c73

+ 2 - 2
Framework/Common/CommonData/Vpw/VpwCellCommonData.cs

@@ -23,7 +23,7 @@ namespace MECF.Framework.Common.CommonData.Vpw
 
         public bool VentValve { get { return _ventValve; } set { _ventValve = value;InvokePropertyChanged(nameof(VentValve)); } }
 
-        public bool DiwDrain { get { return _diwDrain; } set { _diwDrain = value;InvokePropertyChanged(nameof(DiwDrain)); } }
+        public bool DrainValve { get { return _drainValve; } set { _drainValve = value;InvokePropertyChanged(nameof(DrainValve)); } }
 
         #endregion
 
@@ -35,7 +35,7 @@ namespace MECF.Framework.Common.CommonData.Vpw
         private bool _flowLarge;
         private bool _vacuumValve;
         private bool _ventValve;
-        private bool _diwDrain;
+        private bool _drainValve;
         #endregion
     }
 }

+ 2 - 0
Framework/Common/DataCenter/IQueryDataService.cs

@@ -37,6 +37,7 @@ using MECF.Framework.Common.Persistent.Reservoirs;
 using MECF.Framework.Common.Persistent.Rinse;
 using MECF.Framework.Common.Persistent.SRD;
 using MECF.Framework.Common.Persistent.Temperature;
+using MECF.Framework.Common.Persistent.VpwCell;
 using MECF.Framework.Common.Persistent.VpwMain;
 using MECF.Framework.Common.ProcessCell;
 using MECF.Framework.Common.RecipeCenter;
@@ -169,6 +170,7 @@ namespace MECF.Framework.Common.DataCenter
     [ServiceKnownType(typeof(VpwMainCommonData))]
     [ServiceKnownType(typeof(VpwCellCommonData))]
     [ServiceKnownType(typeof(VpwMainPersistentValue))]
+    [ServiceKnownType(typeof(VpwCellPersistentValue))]
     [ServiceKnownType(typeof(PrewetPersistentValue))]
     [ServiceKnownType(typeof(SafetyData))]
     [ServiceKnownType(typeof(RinseData))]

+ 2 - 2
Framework/Common/Persistent/VpwCell/VpwCellPersistentManager.cs

@@ -60,10 +60,10 @@ namespace MECF.Framework.Common.Persistent.VpwCell
             }
         }
         /// <summary>
-        /// 获取Rinse Persistent数值
+        /// 获取Persistent数值
         /// </summary>
         /// <returns></returns>
-        public VpwCellPersistentValue GetRinsePersistentValue(string module)
+        public VpwCellPersistentValue GetPersistentValue(string module)
         {
             VpwCellPersistentValue value = new VpwCellPersistentValue();
             if (_persistentValueDic.ContainsKey(module) == false)

+ 373 - 1
PunkHPX8_MainPages/ViewModels/VPWCellViewModel.cs

@@ -1,14 +1,386 @@
-using Prism.Mvvm;
+using Aitex.Core.UI.MVVM;
+using MECF.Framework.Common.CommonData.Vpw;
+using MECF.Framework.Common.DataCenter;
+using MECF.Framework.Common.OperationCenter;
+using MECF.Framework.Common.Persistent.VpwCell;
+using MECF.Framework.Common.Persistent.VpwMain;
+using MECF.Framework.Common.Utilities;
+using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows.Input;
+using System.Windows.Threading;
 
 namespace PunkHPX8_MainPages.ViewModels
 {
+
     public class VPWCellViewModel:BindableBase
     {
 
+        #region 常量
+        private const string COMMONDATA = "CommonData";
+        private const string VPW = "vpw";
+        private const string PERSISTENT_VALUE = "PersistentValue";
+        #endregion
+
+        #region 内部变量
+
+        #region Common
+        /// <summary>
+        /// 模块名称
+        /// </summary>
+        private string _module;
+        /// <summary>
+        /// StateMachine
+        /// </summary>
+        private string _stateMachine;
+        /// <summary>
+        /// Status
+        /// </summary>
+        private string _status;
+        /// <summary>
+        /// 数据
+        /// </summary>
+        private VpwCellCommonData _vpwCellCommonData;
+        /// <summary>
+        /// VPW Main数据
+        /// </summary>
+        private VpwMainCommonData _vpwMainCommonData;
+        /// <summary>
+        /// Threshold
+        /// </summary>
+        private VpwCellPersistentValue _vpwCellPersistent;
+        /// <summary>
+        /// 是否是Manual模式
+        /// </summary>
+        private bool _isManualOperationMode;
+        #endregion
+
+        #region VPW recipe
+        /// <summary>
+        /// RecipeModuleName
+        /// </summary>
+        private string _recipeModuleName;
+        /// <summary>
+        /// RecipeType
+        /// </summary>
+        private string _recipeType;
+        /// <summary>
+        /// AchievedRunRecipeCycle
+        /// </summary>
+        private int _achievedRunRecipeCycle;
+        /// <summary>
+        /// 当前Recipe
+        /// </summary>
+        private string _currentRecipe;
+        /// <summary>
+        /// RecipeContent
+        /// </summary>
+        private string _recipeContent;
+        /// <summary>
+        /// TimeRemaining 
+        /// </summary>
+        private int _timeRemaining;
+        /// <summary>
+        /// OfTotalTime 
+        /// </summary>
+        private int _totalTime;
+        /// <summary>
+        /// OperatingMode 
+        /// </summary>
+        private string _operatingMode;
+        /// <summary>
+        /// State Machine
+        /// </summary>
+        private string _state;
+        /// <summary>
+        /// RecipeMode 
+        /// </summary>
+        private string _recipeMode;
+        #endregion
+
+
+        #region UI
+
+        /// <summary>
+        /// IsErrorState 用于腔体变红
+        /// </summary>
+        private bool _isErrorState;
+        /// <summary>
+        /// 页面功能启用
+        /// </summary>
+        private bool _isEnabled;
+        /// <summary>
+        /// AutoMode页面功能启用
+        /// </summary>
+        private bool _isAutoEnabled;
+        #endregion
+
+
+        #endregion
+
+        #region 系统数据
+        /// <summary>
+        /// 定时器
+        /// </summary>
+        DispatcherTimer _timer;
+        /// <summary>
+        /// 查询后台数据集合
+        /// </summary>
+        private List<string> _rtDataKeys = new List<string>();
+        /// <summary>
+        /// rt查询key数值字典
+        /// </summary>
+        private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
+        #endregion
+
+
+
+
+        #region 属性
+
+        #region Common
+        /// <summary>
+        /// 模块名称
+        /// </summary>
+        public string Module { get { return _module; } set { SetProperty(ref _module, value); } }
+        /// <summary>
+        /// StateMachine
+        /// </summary>
+        public string StateMachine { get { return _stateMachine; } set { SetProperty(ref _stateMachine, value); } }
+        /// <summary>
+        /// Status
+        /// </summary>
+        public string Status { get { return _status; } set { SetProperty(ref _status, value); } }
+        /// <summary>
+        /// Commondata
+        /// </summary>
+        public VpwMainCommonData VpwMainCommonData
+        {
+            get { return _vpwMainCommonData; }
+            set { SetProperty(ref _vpwMainCommonData, value); }
+        }
+        /// <summary>
+        /// Commondata
+        /// </summary>
+        public VpwCellCommonData VpwCellCommonData
+        {
+            get { return _vpwCellCommonData; }
+            set { SetProperty(ref _vpwCellCommonData, value); }
+        }
+
+        /// <summary>
+        /// Persistent
+        /// </summary>
+        public VpwCellPersistentValue VpwCellPersistent
+        {
+            get { return _vpwCellPersistent; }
+            set { SetProperty(ref _vpwCellPersistent, value); }
+        }
+
+        /// <summary>
+        /// 是否是Manual模式
+        /// </summary>
+        public bool IsManualOperationMode { get { return _isManualOperationMode; } set { SetProperty(ref _isManualOperationMode, value); } }
+        #endregion
+
+        #region VPW recipe
+        /// <summary>
+        /// RecipeModuleName
+        /// </summary>
+        public string RecipeModuleName
+        {
+            get { return _recipeModuleName; }
+            set { SetProperty(ref _recipeModuleName, value); }
+        }
+        /// <summary>
+        /// RecipeType
+        /// </summary>
+        public string RecipeType
+        {
+            get { return _recipeType; }
+            set { SetProperty(ref _recipeType, value); }
+        }
+
+        public int AchievedRunRecipeCycle
+        {
+            get { return _achievedRunRecipeCycle; }
+            set { SetProperty(ref _achievedRunRecipeCycle, value); }
+        }
+        /// <summary>
+        /// 当前运行的Recipe
+        /// </summary>
+        public string CurrentRecipe
+        {
+            get { return _currentRecipe; }
+            set { SetProperty(ref _currentRecipe, value); }
+        }
+        /// <summary>
+        /// RecipeContent
+        /// </summary>
+        public string RecipeContent
+        {
+            get { return _recipeContent; }
+            set { SetProperty(ref _recipeContent, value); }
+        }
+        /// <summary>
+        /// TimeRemaining 
+        /// </summary>
+        public int TimeRemaining
+        {
+            get { return _timeRemaining; }
+            set { SetProperty(ref _timeRemaining, value); }
+        }
+        /// <summary>
+        /// TotalTime  
+        /// </summary>
+        public int TotalTime
+        {
+            get { return _totalTime; }
+            set { SetProperty(ref _totalTime, value); }
+        }
+        /// <summary>
+        /// OperatingMode
+        /// </summary>
+        public string OperatingMode
+        {
+            get { return _operatingMode; }
+            set { SetProperty(ref _operatingMode, value); }
+        }
+        /// <summary>
+        /// State
+        /// </summary>
+        public string State
+        {
+            get { return _state; }
+            set { SetProperty(ref _state, value); }
+        }
+        /// <summary>
+        /// RecipeMode
+        /// </summary>
+        public string RecipeMode
+        {
+            get { return _recipeMode; }
+            set { SetProperty(ref _recipeMode, value); }
+        }
+        #endregion
+
+
+
+        #region UI
+        /// <summary>
+        /// IsErrorState
+        /// </summary>
+        public bool IsErrorState { get { return _isErrorState; } set { SetProperty(ref _isErrorState, value); } }
+        /// <summary>
+        /// 页面功能启用
+        /// </summary>
+        public bool IsEnabled
+        {
+            get { return _isEnabled; }
+            set { SetProperty(ref _isEnabled, value); }
+        }
+        /// <summary>
+        /// AutoMode页面功能启用
+        /// </summary>
+        public bool IsAutoEnabled
+        {
+            get { return _isAutoEnabled; }
+            set { SetProperty(ref _isAutoEnabled, value); }
+        }
+        #endregion
+
+        #endregion
+
+        #region Command指令
+        public ICommand InitializeCommand { get; set; }
+        public ICommand HomeCommand { get; set; }
+
+        #endregion
+
+        public VPWCellViewModel()
+        {
+            InitializeCommand = new DelegateCommand<object>(InitializeAction);
+            HomeCommand = new DelegateCommand<object>(HomeAction);
+        }
+
+
+        /// <summary>
+        /// 加载数据
+        /// </summary>
+        public void LoadData(string systemName)
+        {
+            Module = systemName;
+
+            _rtDataKeys.Clear();
+            List<string> lst = new List<string>();
+            _rtDataValueDic = QueryDataClient.Instance.Service.PollData(lst);
+
+            _rtDataKeys.Add($"{Module}.{PERSISTENT_VALUE}");
+            _rtDataKeys.Add($"{Module}.{COMMONDATA}");
+            _rtDataKeys.Add($"{Module}.MachineState");
+            _rtDataKeys.Add($"VPWMain1.{COMMONDATA}");
+
+            if (_timer == null)
+            {
+                _timer = new DispatcherTimer();
+                _timer.Interval = TimeSpan.FromMilliseconds(200);
+                _timer.Tick += Timer_Tick;
+            }
+            _timer.Start();
+        }
+        /// <summary>
+        /// 定时器执行
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+            if (_rtDataKeys.Count != 0)
+            {
+                _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
+                if (_rtDataValueDic != null)
+                {
+                    VpwCellCommonData = CommonFunction.GetValue<VpwCellCommonData>(_rtDataValueDic, $"{Module}.{COMMONDATA}");
+                    VpwMainCommonData = CommonFunction.GetValue<VpwMainCommonData>(_rtDataValueDic, $"VPWMain1.{COMMONDATA}");
+                    VpwCellPersistent = CommonFunction.GetValue<VpwCellPersistentValue>(_rtDataValueDic, $"{Module}.{PERSISTENT_VALUE}");
+                }
+            }
+        }
+        /// <summary>
+        /// 隐藏
+        /// </summary>
+        public void Hide()
+        {
+            if (_timer != null)
+            {
+                _timer.Stop();
+            }
+        }
+
+
+
+        #region 指令Action
+        /// <summary>
+        /// Initialize Action
+        /// </summary>
+        /// <param name="param"></param>
+        private void InitializeAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
+        }
+        /// <summary>
+        /// Home Action
+        /// </summary>
+        /// <param name="param"></param>
+        private void HomeAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.Home");
+        }
+        #endregion
+
     }
 }

+ 20 - 6
PunkHPX8_MainPages/Views/VPWCellView.xaml

@@ -32,8 +32,13 @@
         </Grid.ColumnDefinitions>
         <Grid Grid.Row="1" Grid.Column="0">
             <UserControls:SrdOverviewInformationPanel HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" 
-                           ModuleTitle="{Binding Module}" IsEnabled="{Binding IsEnabled}"
-                            />
+                            ModuleTitle="{Binding Module}" IsEnabled="{Binding IsEnabled}"
+                            RecipeContentValue="{Binding CurrentRecipe}"
+                            TimeRemainingValue="{Binding TimeRemaining}"
+                            TotalTimeValue="{Binding TotalTime}"
+                            StateValue="{Binding State}"
+                            OperatingModeValue="{Binding VpwCellPersistent.OperatingMode}"
+                            RecipeModeValue="{Binding VpwCellPersistent.RecipeOperatingMode}" />
         </Grid>
         <Grid Grid.Row="1" Grid.Column="1">
             <UserControls:WaferOverviewPanel HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" 
@@ -42,13 +47,22 @@
         </Grid>
         <Grid Grid.Row="2" Grid.Column="0" Grid.RowSpan="2">
             <UserControls:VPWCellStatusControl HorizontalAlignment="Left" Margin="10,-50,0,0" VerticalAlignment="Center" 
-                        IsEnabled="{Binding IsEnabled}"
+                        IsEnabled="True"
+                        WaterPressure="{Binding VpwMainCommonData.DiwPressure}"
+                        ChamberClose="{Binding VpwMainCommonData.ChamberClosed}"
+                        ChamberOpen="{Binding VpwMainCommonData.ChamberOpened}"
                          />
         </Grid>
         <Grid Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="3" HorizontalAlignment="Left">
             <UserControls:VPWCellUIControl ModuleName="{Binding Module}"
+                                           DripValve="{Binding VpwCellCommonData.FlowDrip}"
+                                           SmallValve="{Binding VpwCellCommonData.FlowSmall}"
+                                           LargeValve="{Binding VpwCellCommonData.FlowLarge}"
+                                           VentValve="{Binding VpwCellCommonData.VentValve}"
+                                           DrainValve="{Binding VpwCellCommonData.DrainValve}"
+                                           VacuumValve="{Binding VpwCellCommonData.VacuumValve}"
                                    
-         
+          
          ></UserControls:VPWCellUIControl>
         </Grid>
 
@@ -68,7 +82,7 @@
         <Grid Grid.Row="2" Grid.Column="3" Grid.RowSpan="2" Margin="25,0,0,80" VerticalAlignment="Center">
             <UserControls:RecipeModeControl Margin="5,40,35,10"
                                      ModuleName="{Binding Module}"
-                                     RecipeModeValue="{Binding VpwMainPersistent.RecipeOperatingMode}"
+                                     RecipeModeValue="{Binding VpwCellPersistent.RecipeOperatingMode}"
                                      ></UserControls:RecipeModeControl>
         </Grid>
 
@@ -90,7 +104,7 @@
             <Label Content="Operating Mode"  FontSize="15" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Center"></Label>
             <UserControls:OperatingModeControl HorizontalAlignment="Center" Margin="10,0,30,80" VerticalAlignment="Center" 
                                         ModuleName="{Binding Module}"
-                                        OperationModeValue="{Binding PrewetPersistent.OperatingMode}"
+                                        OperationModeValue="{Binding VpwCellPersistent.OperatingMode}"
                                         IsManual="{Binding IsManualOperationMode,Mode=TwoWay}"/>
         </Grid>
 

+ 137 - 4
PunkHPX8_RT/Devices/VpwCell/VpwCellDevice.cs

@@ -1,5 +1,6 @@
 using Aitex.Core.RT.DataCenter;
 using Aitex.Core.RT.Device;
+using Aitex.Core.RT.Log;
 using Aitex.Core.RT.OperationCenter;
 using Aitex.Core.Util;
 using MECF.Framework.Common.Beckhoff.ModuleIO;
@@ -7,7 +8,11 @@ using MECF.Framework.Common.CommonData.Prewet;
 using MECF.Framework.Common.CommonData.Vpw;
 using MECF.Framework.Common.IOCore;
 using MECF.Framework.Common.Persistent.SRD;
+using MECF.Framework.Common.Persistent.VpwCell;
+using MECF.Framework.Common.Persistent.VpwMain;
 using PunkHPX8_RT.Devices.AXIS;
+using PunkHPX8_RT.Modules;
+using PunkHPX8_RT.Modules.VpwMain;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -28,7 +33,8 @@ namespace PunkHPX8_RT.Devices.VpwCell
         private const string FLOW_LARGE = "FlowLarge";
         private const string VACUUM_VALVE = "VacuumValve";
         private const string VENT_VALVE = "VentValve";
-        private const string DIW_DRAIN = "DiwDrain";
+        private const string DRAIN_VALVE = "DrainValve";
+        private const string PERSISTENT_VALUE = "PersistentValue";
         #endregion
 
         #region 内部变量
@@ -41,6 +47,10 @@ namespace PunkHPX8_RT.Devices.VpwCell
         /// </summary>
         private VpwCellCommonData _commonData=new VpwCellCommonData();
         /// <summary>
+        /// 持久性数值
+        /// </summary>
+        private VpwCellPersistentValue _vpwCellPersistentValue;
+        /// <summary>
         /// 水平电机
         /// </summary>
         private JetAxisBase _rotationAxis;
@@ -81,6 +91,8 @@ namespace PunkHPX8_RT.Devices.VpwCell
         private void InitializeParameter()
         {
             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
+            _vpwCellPersistentValue = VpwCellPersistentManager.Instance.GetPersistentValue(Module);
+           
         }
         /// <summary>
         /// 初始化Routine
@@ -95,6 +107,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
         private void SubscribeData()
         {
             DATA.Subscribe($"{Module}.{COMMON_DATA}", () => CommonData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _vpwCellPersistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
         }
         /// <summary>
         /// 订阅数据
@@ -102,7 +115,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
         private void SubscribeValueAction()
         {
             IoSubscribeUpdateVariable(DIW_FLOW);
-            IoSubscribeUpdateVariable(DIW_DRAIN);
+            IoSubscribeUpdateVariable(DRAIN_VALVE);
             IoSubscribeUpdateVariable(VACUUM_PRESSURE);
             IoSubscribeUpdateVariable(VACUUM_VALVE);
             IoSubscribeUpdateVariable(VENT_VALVE);
@@ -155,6 +168,12 @@ namespace PunkHPX8_RT.Devices.VpwCell
             OP.Subscribe($"{Module}.VacuumValveOn", (cmd, para) => { return VacuumValveOn(); });
             OP.Subscribe($"{Module}.VacuumValveOff", (cmd, para) => { return VacuumValveOff(); });
 
+            OP.Subscribe($"{Module}.DisabledAction", DisabledOperation);
+            OP.Subscribe($"{Module}.ManualAction", ManualOperation);
+            OP.Subscribe($"{Module}.AutoAction", AutoOperation);
+            OP.Subscribe($"{Module}.EngineeringModeAction", EngineeringModeOperation);
+            OP.Subscribe($"{Module}.ProductionModeAction", ProductionModeOperation);
+
         }
         #endregion
 
@@ -233,7 +252,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
         /// <returns></returns>
         private bool DrainValveOn()
         {
-            return WriteVariableValue(DIW_DRAIN, true);
+            return WriteVariableValue(DRAIN_VALVE, true);
         }
         /// <summary>
         /// Vent Valve Off
@@ -241,7 +260,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
         /// <returns></returns>
         private bool DrainValveOff()
         {
-            return WriteVariableValue(DIW_DRAIN, false);
+            return WriteVariableValue(DRAIN_VALVE, false);
         }
         /// <summary>
         /// Vacuum valve on
@@ -260,6 +279,120 @@ namespace PunkHPX8_RT.Devices.VpwCell
             return WriteVariableValue(VACUUM_VALVE, false);
         }
 
+
+        /// <summary>
+        /// DisabledAction
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        private bool DisabledOperation(string cmd, object[] args)
+        {
+            string currentOperation = "Disabled";
+            VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
+            if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
+            {
+                string preOperation = _vpwCellPersistentValue.OperatingMode;
+                if (vpwCellEntity.IsBusy)
+                {
+                    LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Disabled mode");
+                    return false;
+                }
+
+                vpwCellEntity.EnterInit();
+
+                _vpwCellPersistentValue.OperatingMode = currentOperation;
+
+                LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
+            }
+            VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
+            return true;
+        }
+        /// <summary>
+        /// ManualAction
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        private bool ManualOperation(string cmd, object[] args)
+        {
+            string currentOperation = "Manual";
+            VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
+            if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
+            {
+                string preOperation = _vpwCellPersistentValue.OperatingMode;
+                if (vpwCellEntity.IsBusy)
+                {
+                    LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Manual mode");
+                    return false;
+                }
+                vpwCellEntity.EnterInit();
+                _vpwCellPersistentValue.OperatingMode = currentOperation;
+
+                LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
+            }
+            VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
+            return true;
+        }
+        /// <summary>
+        /// AutoAction
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        private bool AutoOperation(string cmd, object[] args)
+        {
+            string currentOperation = "Auto";
+            VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
+            if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
+            {
+                string preOperation = _vpwCellPersistentValue.OperatingMode;
+                if (vpwCellEntity.IsBusy)
+                {
+                    LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Auto mode");
+                    return false;
+                }
+                vpwCellEntity.EnterInit();
+                _vpwCellPersistentValue.OperatingMode = currentOperation;
+
+                LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
+            }
+
+            VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
+            return true;
+        }
+        /// <summary>
+        /// EngineeringModeAction
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        private bool EngineeringModeOperation(string cmd, object[] args)
+        {
+            string currentRecipeOperation = "Engineering";
+            if (_vpwCellPersistentValue != null)
+            {
+                _vpwCellPersistentValue.RecipeOperatingMode = currentRecipeOperation;
+            }
+            VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
+            return true;
+        }
+        /// <summary>
+        /// ProductionAction
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        private bool ProductionModeOperation(string cmd, object[] args)
+        {
+            string currentRecipeOperation = "Production";
+            if (_vpwCellPersistentValue != null)
+            {
+                _vpwCellPersistentValue.RecipeOperatingMode = currentRecipeOperation;
+            }
+            VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
+            return true;
+        }
         /// <summary>
         /// 写变量
         /// </summary>

+ 11 - 1
PunkHPX8_RT/Modules/VpwCell/VpwCellEntity.cs

@@ -94,7 +94,17 @@ namespace PunkHPX8_RT.Modules.VpwMain
         {
             return false;
         }
-
+        /// <summary>
+        /// EnterInit
+        /// </summary>
+        public void EnterInit()
+        {
+            //if ((VpwMainState)fsm.State != PrewetState.Idle) return;
+            //else
+            //{
+            //    CheckToPostMessage<PrewetState, PrewetMsg>(eEvent.ERR_PREWET, Module.ToString(), (int)PrewetMsg.Init);
+            //}
+        }
         public int Invoke(string function, params object[] args)
         {
             switch (function)

+ 2 - 2
PunkHPX8_Themes/UserControls/ReservoirPump.xaml

@@ -8,8 +8,8 @@
              d:DesignHeight="70" d:DesignWidth="70">
     <UserControl.Resources>
         <ContextMenu x:Key="ValveOpen">
-            <MenuItem Name="Open" Header="打开" Click="OpenClick"></MenuItem>
-            <MenuItem Name="Close" Header="关闭" Click="CloseClick"></MenuItem>
+            <MenuItem Name="Open" Header="Open" Click="OpenClick"></MenuItem>
+            <MenuItem Name="Close" Header="Close" Click="CloseClick"></MenuItem>
         </ContextMenu>
         <Style x:Key="StackPanelStyle" TargetType="StackPanel">
             <Style.Setters>

+ 2 - 2
PunkHPX8_Themes/UserControls/VPWCellStatusControl.xaml

@@ -81,7 +81,7 @@
 
         <Grid Grid.Row="4" Grid.Column="1">
             <Ellipse Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stroke="Silver"
-    Fill="{Binding ChamberOpen, Converter={StaticResource boolToColor}, ElementName=self}"/>
+    Fill="{Binding ChamberClose, Converter={StaticResource boolToColor}, ElementName=self}"/>
         </Grid>
         <Grid Grid.Row="4" Grid.Column="2" >
             <Button Style="{StaticResource SysBtnStyle}" Margin="0,0,0,0" Grid.Column="1" Height="25" Width="60" HorizontalAlignment="Center" Content="Open" Click="ChamberOpen_Click"></Button>
@@ -91,7 +91,7 @@
         </Grid>
         <Grid Grid.Row="4" Grid.Column="4">
             <Ellipse Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stroke="Silver"
-Fill="{Binding ChamberClose, Converter={StaticResource boolToColor}, ElementName=self}"/>
+Fill="{Binding ChamberOpen, Converter={StaticResource boolToColor}, ElementName=self}"/>
         </Grid>
 
         <Border Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="4" Margin="5,5,5,5" Background="Black">

+ 2 - 2
PunkHPX8_Themes/UserControls/VPWCellStatusControl.xaml.cs

@@ -180,12 +180,12 @@ namespace PunkHPX8_Themes.UserControls
 
         private void ChamberOpen_Click(object sender, RoutedEventArgs e)
         {
-            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ChamberUp");
+            InvokeClient.Instance.Service.DoOperation($"VPWMain1.ChamberUp");
         }
 
         private void ChamberClose_Click(object sender, RoutedEventArgs e)
         {
-            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ChamberDown");
+            InvokeClient.Instance.Service.DoOperation($"VPWMain1.ChamberDown");
         }
 
         private void RotationStart_Click(object sender, RoutedEventArgs e)

+ 14 - 13
PunkHPX8_Themes/UserControls/VPWCellUIControl.xaml.cs

@@ -1,4 +1,5 @@
-using System;
+using MECF.Framework.Common.OperationCenter;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -182,62 +183,62 @@ namespace PunkHPX8_Themes.UserControls
 
         private void OpenDripValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.FlowDripOn");
         }
 
         private void CloseDripValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.FlowDripOff");
         }
 
         private void OpenSmallValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.FlowSmallOn");
         }
 
         private void CloseSmallValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.FlowSmallOff");
         }
 
         private void OpenLargeValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.FlowLargeOn");
         }
 
         private void CloseLargeValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.FlowLargeOff");
         }
 
         private void OpenVentValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VentValveOn");
         }
 
         private void CloseVentValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VentValveOff");
         }
 
         private void OpenDrainValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DrainValveOn");
         }
 
         private void CloseDrainValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DrainValveOff");
         }
 
         private void OpenCellVacuumValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumValveOn");
         }
 
         private void CloseCellVacuumValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumValveOff");
         }
     }
 }

+ 2 - 2
PunkHPX8_Themes/UserControls/VPWMainStateControl.xaml

@@ -74,7 +74,7 @@
 
         <Grid Grid.Row="5" Grid.Column="1">
             <Ellipse Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stroke="Silver"
-    Fill="{Binding ChamberOpen, Converter={StaticResource boolToColor}, ElementName=self}"/>
+    Fill="{Binding ChamberClose, Converter={StaticResource boolToColor}, ElementName=self}"/>
         </Grid>
         <Grid Grid.Row="5" Grid.Column="2" >
             <Button Style="{StaticResource SysBtnStyle}" Margin="0,0,0,0" Grid.Column="1" Height="25" Width="60" HorizontalAlignment="Center" Content="Open" Click="ChamberOpen_Click"></Button>
@@ -84,7 +84,7 @@
         </Grid>
         <Grid Grid.Row="5" Grid.Column="4">
             <Ellipse Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Stroke="Silver"
-Fill="{Binding ChamberClose, Converter={StaticResource boolToColor}, ElementName=self}"/>
+Fill="{Binding ChamberOpen, Converter={StaticResource boolToColor}, ElementName=self}"/>
         </Grid>
 
         <Border Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="4" Margin="5,5,5,5" Background="Black">

+ 21 - 1
PunkHPX8_Twincate/PunkHPX8/PlcTest/POUs/MAIN.TcPOU

@@ -196,7 +196,25 @@ IF VPW2RotationModeOfOperation=1 THEN
 		VPW2RotationStatusWord :=1591;
 	END_IF
 	END_IF
-END_IF]]></ST>
+END_IF
+
+IF VPW_DO_16CHANNEL_EL2809_101_7=TRUE THEN
+	VPW_DI_16CHANNEL_EL1819_N100_9:=TRUE;
+ELSE IF VPW_DO_16CHANNEL_EL2809_101_7=FALSE THEN
+	VPW_DI_16CHANNEL_EL1819_N100_9:=FALSE;
+END_IF
+END_IF
+
+
+IF MOTION_DO_16CHANNEL_EL2809_N401_15=TRUE THEN
+	VPW_DI_16CHANNEL_EL1819_N100_1:=TRUE;
+	VPW_DI_16CHANNEL_EL1819_N100_2:=FALSE;
+ELSE
+    VPW_DI_16CHANNEL_EL1819_N100_1:=FALSE;
+	VPW_DI_16CHANNEL_EL1819_N100_2:=TRUE;
+	
+END_IF
+]]></ST>
     </Implementation>
     <LineIds Name="MAIN">
       <LineId Id="52" Count="5" />
@@ -209,6 +227,8 @@ END_IF]]></ST>
       <LineId Id="18" Count="0" />
       <LineId Id="135" Count="42" />
       <LineId Id="134" Count="0" />
+      <LineId Id="287" Count="16" />
+      <LineId Id="286" Count="0" />
     </LineIds>
   </POU>
 </TcPlcObject>