| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687 | 
							- using Aitex.Core.RT.DataCenter;
 
- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.OperationCenter;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.Beckhoff.ModuleIO;
 
- using MECF.Framework.Common.CommonData.Metal;
 
- using MECF.Framework.Common.CommonData.PlatingCell;
 
- using MECF.Framework.Common.CommonData.Reservoir;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.IOCore;
 
- using MECF.Framework.Common.Persistent.Reservoirs;
 
- using MECF.Framework.Common.ToolLayout;
 
- using PunkHPX8_Core;
 
- using PunkHPX8_RT.Devices.AXIS;
 
- using PunkHPX8_RT.Devices.LinMot;
 
- using PunkHPX8_RT.Devices.PowerSupplier;
 
- using PunkHPX8_RT.Devices.Reservoir;
 
- using PunkHPX8_RT.Devices.VpwMain;
 
- using PunkHPX8_RT.Modules;
 
- using PunkHPX8_RT.Modules.PlatingCell;
 
- using PunkHPX8_RT.Modules.Reservoir;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Reflection;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- namespace PunkHPX8_RT.Devices.PlatingCell
 
- {
 
-     public class PlatingCellDevice : BaseDevice, IDevice
 
-     {
 
-         #region 常量 
 
-         private const string PERSISTENT_VALUE = "PersistentValue";
 
-         private const string PLATINGCELLDATA = "PlatingCellData";
 
-         private const string AUTO = "Auto";
 
-         private const string MANUAL = "Manual";
 
-         private const string STRATUS = "Stratus";
 
-         private const string DISABLED = "Disabled";
 
-         
 
-         
 
-         private const string IS_HEAD_TILT = "IsHeadTilt";
 
-         private const string IS_HEAD_VERTICAL = "IsHeadVertical";
 
-         private const string CLAMSHELL_DISTANCE = "ClamShellDistance";
 
-         private const string CLAMSHELL_CYLINDER_PRESSURE = "ClamShellCylinderPressure";
 
-         private const string OVERFLOW_LEVEL = "OverFlowLevel";
 
-         private const string CLAMSHELL_CLOSE = "ClamShellClose";
 
-         private const string HEAD_TILT = "HeadTilt";
 
-         private const string CCR_ENABLE = "CCREnable";
 
-         private const string RINSE_ENABLE = "RinseEnable";
 
-         #endregion
 
-         #region 内部变量
 
-         /// 变量是否初始化字典
 
-         /// </summary>
 
-         private Dictionary<string, bool> _variableInitializeDic = new Dictionary<string, bool>();
 
-         /// <summary>
 
-         /// 操作当前状态
 
-         /// </summary>
 
-         protected RState _status;
 
-         /// <summary>
 
-         /// 持久化数据
 
-         /// </summary>
 
-         protected PlatingCellPersistentValue _persistentValue;
 
-         /// <summary>
 
-         /// PlatingCell项
 
-         /// </summary>
 
-         private PlatingCellItem _platingCellItem;
 
-         /// <summary>
 
-         /// overflow
 
-         /// </summary>
 
-         private int _overflowLevelHigh = 85;
 
-         private int _overflowLevelLow = 25;
 
-         /// <summary>
 
-         /// 对应reservoir的名字
 
-         /// </summary>
 
-         private string _reservoirName;
 
-         /// <summary>
 
-         /// PowerSupplier
 
-         /// </summary>
 
-         protected CellPowerSupplier _powerSupplier;
 
-         /// <summary>
 
-         /// vertical电机
 
-         /// </summary>
 
-         private JetAxisBase _verticalAxis;
 
-         /// <summary>
 
-         /// vertical电机
 
-         /// </summary>
 
-         private JetAxisBase _rotationAxis;
 
-         /// <summary>
 
-         /// CCR当前执行步骤
 
-         /// </summary>
 
-         private string _currentCCRStep = "";
 
-         /// <summary>
 
-         /// CCR当前剩余时间
 
-         /// </summary>
 
-         private double _timeRemain;
 
-         #endregion
 
-         #region 属性
 
-         /// <summary>
 
-         /// 状态
 
-         /// </summary>
 
-         public RState Status { get { return _status; } }
 
-         /// <summary>
 
-         /// 是否禁用
 
-         /// </summary>
 
-         public bool IsDisable { get { return _persistentValue == null || _persistentValue.OperatingMode == DISABLED; } }
 
-        
 
-         /// <summary>
 
-         /// 操作模式
 
-         /// </summary>
 
-         public string OperationMode { get { return _persistentValue.OperatingMode; } }
 
-         /// <summary>
 
-         /// 工程模式
 
-         /// </summary>
 
-         public string EngineerMode { get { return _persistentValue.RecipeOperatingMode; } }
 
-         /// <summary>
 
-         /// 是否为Auto
 
-         /// </summary>
 
-         public bool IsAuto { get { return _persistentValue != null ? _persistentValue.OperatingMode == AUTO : false; } }
 
-         /// <summary>
 
-         /// 是否为Auto
 
-         /// </summary>
 
-         public bool IsManual { get { return _persistentValue != null ? _persistentValue.OperatingMode == MANUAL : false; } }
 
-         /// <summary>
 
-         /// A面PowerSupplier
 
-         /// </summary>
 
-         public CellPowerSupplier PowerSupplier { get { return _powerSupplier; } }
 
-         #endregion
 
-         #region 共享变量
 
-         /// <summary>
 
-         /// 数据
 
-         /// </summary>
 
-         protected PlatingCellData _platingCellData = new PlatingCellData();
 
-         /// <summary>
 
-         /// 对应reservoir数据
 
-         /// </summary>
 
-         protected ReservoirData _reservoirData = new ReservoirData();
 
-         #endregion
 
-         #region 属性
 
-         /// <summary>
 
-         /// 设备数据
 
-         /// </summary>
 
-         public PlatingCellData PlatingCellDeviceData { get { return _platingCellData; } }
 
-   
 
-         #endregion
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         /// <param name="moduleName"></param>
 
-         public PlatingCellDevice(string moduleName) : base(moduleName, moduleName, moduleName, moduleName)
 
-         {
 
-             
 
-         }
 
-         /// <summary>
 
-         /// 初始化
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public virtual bool Initialize()
 
-         {
 
-             InitializeParameter();
 
-             SubscribeData();
 
-             InitializeOperation();
 
-             SubscribeValueAction();
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 定时器执行
 
-         /// </summary>
 
-         public bool OnTimer(int interval)
 
-         {
 
-             if (_verticalAxis != null)
 
-             {
 
-                 _verticalAxis.OnTimer();
 
-             }
 
-             if (_rotationAxis != null) 
 
-             { 
 
-                 _rotationAxis.OnTimer();
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 初始化参数
 
-         /// </summary>
 
-         private void InitializeParameter()
 
-         {
 
-             _persistentValue = PlatingCellPersistentManager.Instance.GetPlatingCellPersistentValue(Module);
 
-             if (_persistentValue == null)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Persistent Value Object is not exist");
 
-             }
 
-             _platingCellItem = PlatingCellItemManager.Instance.GetPlatingCellItem(Module);
 
-             if (_platingCellItem != null)
 
-             {
 
-             }
 
-             _platingCellItem = PlatingCellItemManager.Instance.GetPlatingCellItem(Module);
 
-             if (_platingCellItem != null)
 
-             {
 
-                 _powerSupplier = DEVICE.GetDevice<CellPowerSupplier>(_platingCellItem.PlatingPowerSupplyID);
 
-             }
 
-             _overflowLevelHigh = SC.GetValue<int>($"PlatingCell.OverflowLevelHigh");
 
-             _overflowLevelLow = SC.GetValue<int>($"PlatingCell.OverflowLevelLow");
 
-             _reservoirData = GetReservoirDevice().ReservoirData;
 
-             _reservoirName = GetReservoirDevice().Module;
 
-             if("PlatingCell1".Equals(Module) || "PlatingCell2".Equals(Module))
 
-             {
 
-                 _verticalAxis = DEVICE.GetDevice<JetAxisBase>("PlatingCell1_2.Vertical");
 
-             }
 
-             else
 
-             {
 
-                 _verticalAxis = DEVICE.GetDevice<JetAxisBase>("PlatingCell3_4.Vertical");
 
-             }
 
-             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
 
-         }
 
-         protected virtual void SubscribeValueAction()
 
-         {
 
-             IoSubscribeUpdateVariable(IS_HEAD_TILT);
 
-             IoSubscribeUpdateVariable(IS_HEAD_VERTICAL);
 
-             IoSubscribeUpdateVariable(CLAMSHELL_DISTANCE);
 
-             IoSubscribeUpdateVariable(CLAMSHELL_CYLINDER_PRESSURE);
 
-             IoSubscribeUpdateVariable(OVERFLOW_LEVEL);
 
-             IoSubscribeUpdateVariable(CLAMSHELL_CLOSE);
 
-             IoSubscribeUpdateVariable(HEAD_TILT);
 
-             IoSubscribeUpdateVariable(CCR_ENABLE);
 
-             IoSubscribeUpdateVariable(RINSE_ENABLE);
 
-    
 
-         }
 
-         /// <summary>
 
-         /// 订阅IO变量
 
-         /// </summary>
 
-         /// <param name="variable"></param>
 
-         protected void IoSubscribeUpdateVariable(string variable)
 
-         {
 
-             _variableInitializeDic[variable] = false;
 
-             IOModuleManager.Instance.SubscribeModuleVariable(Module, variable, UpdateVariableValue);
 
-         }
 
-         /// <summary>
 
-         /// 更新变量数值
 
-         /// </summary>
 
-         /// <param name="variable"></param>
 
-         /// <param name="value"></param>
 
-         private void UpdateVariableValue(string variable, object value)
 
-         {
 
-             if (!_platingCellData.IsDataInitialized)
 
-             {
 
-                 _platingCellData.IsDataInitialized = true;
 
-             }
 
-             PropertyInfo property = _platingCellData.GetType().GetProperty(variable);
 
-             if (property != null)
 
-             {
 
-                 property.SetValue(_platingCellData, value);
 
-                 if (variable == OVERFLOW_LEVEL)
 
-                 {
 
-                     double waterLevel = CurrentToWaterLevel(Convert.ToDouble(value));
 
-                     _platingCellData.OverFlowLevel = waterLevel;
 
-                     if (_platingCellData.OverFlowLevel >= _overflowLevelHigh)
 
-                     {
 
-                         _platingCellData.OverFlowStatus = "High";
 
-                     }
 
-                     else if(_platingCellData.OverFlowLevel <= _overflowLevelLow)
 
-                     {
 
-                         _platingCellData.OverFlowStatus = "Empty";
 
-                     }
 
-                     else
 
-                     {
 
-                         _platingCellData.OverFlowStatus = "Full";
 
-                     } 
 
-                 }
 
-             }
 
-             if (_variableInitializeDic.ContainsKey(variable) && !_variableInitializeDic[variable])
 
-             {
 
-                 _variableInitializeDic[variable] = true;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 把电流mA转成水深mm
 
-         /// </summary>
 
-         /// <param name="current"></param>
 
-         private double CurrentToWaterLevel(double current)
 
-         {
 
-             double result = (current - 4) / 8 / 9.8 * 1000;
 
-             return result;
 
-         }
 
-         /// <summary>
 
-         /// 写变量
 
-         /// </summary>
 
-         /// <param name="variable"></param>
 
-         /// <param name="value"></param>
 
-         /// <returns></returns>
 
-         protected bool WriteVariableValue(string variable, object value)
 
-         {
 
-             string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{variable}");
 
-             return IOModuleManager.Instance.WriteIoValue(ioName, value);
 
-         }
 
-         /// <summary>
 
-         /// 订阅数据
 
-         /// </summary>
 
-         private void SubscribeData()
 
-         {
 
-             DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _persistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.{PLATINGCELLDATA}", () => _platingCellData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.ReservoirCommonData", () => _reservoirData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.ReservoirName", () => _reservoirName, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.CurrentCCRStep", () => _currentCCRStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.CurrentCCRTimeRemain", () => _timeRemain, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplierData", () => _powerSupplier.PowerSupplierData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.ID", () => _powerSupplier.Module, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.IsConnected", () => _powerSupplier.IsConnected, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.Voltage", () => _powerSupplier.PowerSupplierData.Voltage, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.Current", () => _powerSupplier.PowerSupplierData.Current, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.SetPoint", () => _powerSupplier.PowerSupplierData.SetPoint, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.RunModel", () => _powerSupplier.PowerSupplierData.PowerRunModelContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.PowerControl", () => _powerSupplier.PowerSupplierData.PowerControlContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.PowerStatus", () => _powerSupplier.PowerSupplierData.PowerStatusContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.Enable", () => _powerSupplier.PowerSupplierData.Enabled, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.PowerSupplier.PowerGrade", () => _powerSupplier.PowerSupplierData.PowerGradeContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-         }
 
-         /// <summary>
 
-         /// 初始化操作
 
-         /// </summary>
 
-         protected virtual void InitializeOperation()
 
-         {
 
-             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);
 
-             OP.Subscribe($"{Module}.SetPlatingCellWaferSize", (cmd, args) => { return SetPlatingCellWaferSize(cmd, args); });
 
-             
 
-             OP.Subscribe($"{Module}.ClamShellClose", (cmd, para) => { return ClamShellClose(); });
 
-             OP.Subscribe($"{Module}.ClamShellOpen", (cmd, para) => { return ClamShellOpen(); });
 
-             OP.Subscribe($"{Module}.HeadtTilt", (cmd, para) => { return HeadtTiltAction(); });
 
-             OP.Subscribe($"{Module}.HeadVertical", (cmd, para) => { return HeadtVerticalAction(); });
 
-             OP.Subscribe($"{Module}.CCREnable", (cmd, para) => { return CCREnableAction(); });
 
-             OP.Subscribe($"{Module}.CCRDisable", (cmd, para) => { return CCRDisableAction(); });
 
-             OP.Subscribe($"{Module}.RinseEnable", (cmd, para) => { return RinseEnableAction(); });
 
-             OP.Subscribe($"{Module}.RinseDisable", (cmd, para) => { return RinseDisableAction(); });
 
-             OP.Subscribe($"{Module}.StartRotation", StartRotationAction);
 
-             OP.Subscribe($"{Module}.StopRotation", StopRotationAction);
 
-         }
 
-         #region Operation
 
-         private bool StartRotationAction(string cmd, object[] args)
 
-         {
 
-             if (args.Length < 2 && (int)args[0] < 0 && (int)args[1] < 0)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_VPW, Module, $"Start rotation paramater is wrong");
 
-                 return false;
 
-             }
 
-             double targetPostion = (int)args[0] * 6 * (int)args[1];
 
-             object[] param = new object[] { "", targetPostion };
 
-             int degSpeed = (int)args[0] * 6;
 
-             SetRotationSpeed(degSpeed);
 
-      
 
-             double AfterChangetargetPostion = (int)args[0] * 6 * (int)args[1];
 
-             return RotationProfilePosition(AfterChangetargetPostion);
 
-         }
 
-         private bool StopRotationAction(string cmd, object[] args)
 
-         {
 
-             return _rotationAxis.StopPositionOperation();
 
-         }
 
-         public bool ClamShellClose()
 
-         {
 
-             return WriteVariableValue(CLAMSHELL_CLOSE, true);
 
-         }
 
-         public bool ClamShellOpen()
 
-         {
 
-             return WriteVariableValue(CLAMSHELL_CLOSE, false);
 
-         }
 
-         public bool HeadtTiltAction()
 
-         {
 
-             return WriteVariableValue(HEAD_TILT, true);
 
-         }
 
-         public bool HeadtVerticalAction()
 
-         {
 
-             return WriteVariableValue(HEAD_TILT, false);
 
-         }
 
-         public bool CCREnableAction()
 
-         {
 
-             return WriteVariableValue(CCR_ENABLE, true);
 
-         }
 
-         public bool CCRDisableAction()
 
-         {
 
-             return WriteVariableValue(CCR_ENABLE, false);
 
-         }
 
-         public bool RinseEnableAction()
 
-         {
 
-             return WriteVariableValue(RINSE_ENABLE, true);
 
-         }
 
-         public bool RinseDisableAction()
 
-         {
 
-             return WriteVariableValue(RINSE_ENABLE, false);
 
-         }
 
-         /// <summary>
 
-         /// DisabledAction
 
-         /// </summary>
 
-         /// <param name="cmd"></param>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         public bool DisabledOperation(string cmd, object[] args)
 
-         {
 
-             string currentOperation = "Disabled";
 
-             PlatingCellEntity platingCellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(Module);
 
-             if (platingCellEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
 
-             {
 
-                 string preOperation = _persistentValue.OperatingMode;
 
-                 if (platingCellEntity.IsBusy)
 
-                 {
 
-                     LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, $"{Module} is Busy, can't switch to Disabled mode");
 
-                     return false;
 
-                 }
 
-                 //if (SchedulerMetalTimeManager.Instance.Contained(Module))
 
-                 //{
 
-                 //    LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is in scheduler, can't switch to Disabled mode");
 
-                 //    return false;
 
-                 //}
 
-                 platingCellEntity.EnterInit();
 
-                 _persistentValue.OperatingMode = currentOperation;
 
-                 LOG.WriteLog(eEvent.INFO_PLATINGCELL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
 
-             }
 
-             PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// ManualAction
 
-         /// </summary>
 
-         /// <param name="cmd"></param>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         public bool ManualOperation(string cmd, object[] args)
 
-         {
 
-             string currentOperation = "Manual";
 
-             PlatingCellEntity platingCellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(Module);
 
-             if (platingCellEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
 
-             {
 
-                 string preOperation = _persistentValue.OperatingMode;
 
-                 if (platingCellEntity.IsBusy)
 
-                 {
 
-                     LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, $"{Module} is Busy, can't switch to Manual mode");
 
-                     return false;
 
-                 }
 
-                 //if (SchedulerMetalTimeManager.Instance.Contained(Module))
 
-                 //{
 
-                 //    LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is in scheduler, can't switch to Manual mode");
 
-                 //    return false;
 
-                 //}
 
-                 platingCellEntity.EnterInit();
 
-                 _persistentValue.OperatingMode = currentOperation;
 
-                 LOG.WriteLog(eEvent.INFO_PLATINGCELL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
 
-             }
 
-             PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// AutoAction
 
-         /// </summary>
 
-         /// <param name="cmd"></param>
 
-         /// <param name="param"></param>
 
-         /// <returns></returns>
 
-         public bool AutoOperation(string cmd, object[] args)
 
-         {
 
-             string currentOperation = "Auto";
 
-             ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(_reservoirName);
 
-             if (reservoirEntity!=null  &&  reservoirEntity.PersistentValue.OperatingMode!="Auto")
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, $"{_reservoirName} not in Auto mode, can't switch to Auto mode");
 
-                 return false;
 
-             }
 
-             PlatingCellEntity platingCellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(Module);
 
-          
 
-             if (platingCellEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
 
-             {
 
-                 string preOperation = _persistentValue.OperatingMode;
 
-                 if (platingCellEntity.IsBusy)
 
-                 {
 
-                     LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, $"{Module} is Busy, can't switch to Auto mode");
 
-                     return false;
 
-                 }
 
-                 platingCellEntity.EnterInit();
 
-                 _persistentValue.OperatingMode = currentOperation;
 
-                 LOG.WriteLog(eEvent.INFO_PLATINGCELL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
 
-             }
 
-             PlatingCellPersistentManager.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 (_persistentValue != null)
 
-             {
 
-                 _persistentValue.RecipeOperatingMode = currentRecipeOperation;
 
-             }
 
-             PlatingCellPersistentManager.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 (_persistentValue != null)
 
-             {
 
-                 _persistentValue.RecipeOperatingMode = currentRecipeOperation;
 
-             }
 
-             PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
 
-             return true;
 
-         }
 
-         private bool SetPlatingCellWaferSize(string cmd, object[] args)
 
-         {
 
-             string metalWaferSize = args[0] as string;
 
-             if (_persistentValue != null)
 
-             {
 
-                 _persistentValue.PlatingCellWaferSize = int.Parse(metalWaferSize);
 
-             }
 
-             PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 获取Reservoir设备
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private ReservoirDevice GetReservoirDevice()
 
-         {
 
-             string reservoir = ReservoirItemManager.Instance.GetReservoirByPlatingCell(Module);
 
-             return DEVICE.GetDevice<ReservoirDevice>(reservoir);
 
-         }
 
-         /// <summary>
 
-         /// CCR当前步骤
 
-         /// </summary>
 
-         /// <param name="tmp"></param>
 
-         public void UpdateStatus(string tmp)
 
-         {
 
-             _currentCCRStep = tmp;
 
-         }
 
-         /// <summary>
 
-         /// CCR当前步骤剩余时间
 
-         /// </summary>
 
-         /// <param name="tmp"></param>
 
-         public void UpdateCCRTimeRemain(double timeRemain)
 
-         {
 
-             _timeRemain = timeRemain;
 
-         }
 
-         #endregion
 
-         #region RotationAxis
 
-         /// <summary>
 
-         /// 电机是否上电
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationSwitchOn()
 
-         {
 
-             return _rotationAxis.IsSwitchOn;
 
-         }
 
-         /// <summary>
 
-         /// Home rotation
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool HomeRotation()
 
-         {
 
-             return _rotationAxis.Home();
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation Home结果
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckHomeEndStatus()
 
-         {
 
-             return CheckRotationEndStatus() && _rotationAxis.IsHomed;
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationEndStatus()
 
-         {
 
-             return _rotationAxis.Status == PunkHPX8_Core.RState.End;
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation失败状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationStopStatus()
 
-         {
 
-             return _rotationAxis.Status == PunkHPX8_Core.RState.Failed;
 
-         }
 
-         /// <summary>
 
-         /// 设置速度
 
-         /// </summary>
 
-         /// <param name="speed"></param>
 
-         /// <returns></returns>
 
-         public bool SetRotationSpeed(int speed)
 
-         {
 
-             _rotationAxis.SetProfileSpeed(speed);
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 改变速度
 
-         /// </summary>
 
-         /// <param name="speed"></param>
 
-         /// <returns></returns>
 
-         public bool ChangeRotationSpeed(int speed)
 
-         {
 
-             return _rotationAxis.ChangeSpeed(speed);
 
-         }
 
-         /// <summary>
 
-         /// 电机运动
 
-         /// </summary>
 
-         /// <param name="position"></param>
 
-         /// <returns></returns>
 
-         public bool RotationProfilePosition(double position)
 
-         {
 
-             return _rotationAxis.ProfilePositionOperation(position);
 
-         }
 
-         /// <summary>
 
-         /// 停止运动 
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool StopProfilePosition()
 
-         {
 
-             return _rotationAxis.StopPositionOperation();
 
-         }
 
-         /// <summary>
 
-         /// 是否Rotation运动
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationRunning()
 
-         {
 
-             return _rotationAxis.IsRun;
 
-         }
 
-         #endregion
 
-         public virtual void Monitor()
 
-         {
 
-         }
 
-         public virtual void Reset()
 
-         {
 
-         }
 
-         public virtual void Terminate()
 
-         {
 
-         }
 
-     }
 
- }
 
 
  |