|
@@ -2,16 +2,24 @@
|
|
|
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.PlatingCell;
|
|
|
+using MECF.Framework.Common.CommonData.Reservoir;
|
|
|
+using MECF.Framework.Common.IOCore;
|
|
|
using MECF.Framework.Common.Persistent.Reservoirs;
|
|
|
using MECF.Framework.Common.ToolLayout;
|
|
|
using PunkHPX8_Core;
|
|
|
using PunkHPX8_RT.Devices.LinMot;
|
|
|
using PunkHPX8_RT.Devices.PowerSupplier;
|
|
|
+using PunkHPX8_RT.Devices.Reservoir;
|
|
|
using PunkHPX8_RT.Modules;
|
|
|
+using PunkHPX8_RT.Modules.PlatingCell;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
+using System.Reflection;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
@@ -25,9 +33,23 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
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";
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 内部变量
|
|
|
+ /// 变量是否初始化字典
|
|
|
+ /// </summary>
|
|
|
+ private Dictionary<string, bool> _variableInitializeDic = new Dictionary<string, bool>();
|
|
|
/// <summary>
|
|
|
/// 操作当前状态
|
|
|
/// </summary>
|
|
@@ -36,18 +58,7 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
/// 持久化数据
|
|
|
/// </summary>
|
|
|
protected PlatingCellPersistentValue _persistentValue;
|
|
|
- /// <summary>
|
|
|
- /// A面PowerSupplier
|
|
|
- /// </summary>
|
|
|
- protected CellPowerSupplier _sideAPowerSupplier;
|
|
|
- /// <summary>
|
|
|
- /// B面PowerSupplier
|
|
|
- /// </summary>
|
|
|
- protected CellPowerSupplier _sideBPowerSupplier;
|
|
|
- /// <summary>
|
|
|
- /// Linmot
|
|
|
- /// </summary>
|
|
|
- protected LinMotAxis _linmotAxis;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// PlatingCell项
|
|
|
/// </summary>
|
|
@@ -73,14 +84,6 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
/// </summary>
|
|
|
public string EngineerMode { get { return _persistentValue.RecipeOperatingMode; } }
|
|
|
/// <summary>
|
|
|
- /// A面PowerSupplier
|
|
|
- /// </summary>
|
|
|
- public CellPowerSupplier SideAPowerSupplier { get { return _sideAPowerSupplier; } }
|
|
|
- /// <summary>
|
|
|
- /// B面PowerSupplier
|
|
|
- /// </summary>
|
|
|
- public CellPowerSupplier SideBPowerSupplier { get { return _sideBPowerSupplier; } }
|
|
|
- /// <summary>
|
|
|
/// 是否为Auto
|
|
|
/// </summary>
|
|
|
public bool IsAuto { get { return _persistentValue != null ? _persistentValue.OperatingMode == AUTO : false; } }
|
|
@@ -88,16 +91,17 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
/// 是否为Auto
|
|
|
/// </summary>
|
|
|
public bool IsManual { get { return _persistentValue != null ? _persistentValue.OperatingMode == MANUAL : false; } }
|
|
|
- /// <summary>
|
|
|
- /// linmot motor on
|
|
|
- /// </summary>
|
|
|
- public bool IsLinmotMotorOn { get { return _linmotAxis != null ? _linmotAxis.IsMotorOn : false; } }
|
|
|
+ #endregion
|
|
|
|
|
|
+ #region 共享变量
|
|
|
/// <summary>
|
|
|
- /// Linmot当前位置
|
|
|
+ /// 数据
|
|
|
/// </summary>
|
|
|
- public double LinmotPosition { get { return _linmotAxis != null ? _linmotAxis.CurrentPosition : 0; } }
|
|
|
+ protected PlatingCellData _platingCellData = new PlatingCellData();
|
|
|
+
|
|
|
#endregion
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 构造函数
|
|
|
/// </summary>
|
|
@@ -115,6 +119,7 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
InitializeParameter();
|
|
|
SubscribeData();
|
|
|
InitializeOperation();
|
|
|
+ SubscribeValueAction();
|
|
|
return true;
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -138,158 +143,107 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
_platingCellItem = PlatingCellItemManager.Instance.GetPlatingCellItem(Module);
|
|
|
if (_platingCellItem != null)
|
|
|
{
|
|
|
- _sideAPowerSupplier = DEVICE.GetDevice<CellPowerSupplier>(_platingCellItem.PlatingPowerSupplyAID);
|
|
|
- _sideBPowerSupplier = DEVICE.GetDevice<CellPowerSupplier>(_platingCellItem.PlatingPowerSupplyBID);
|
|
|
- _linmotAxis = DEVICE.GetDevice<LinMotAxis>(_platingCellItem.LinmotID);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 订阅数据
|
|
|
- /// </summary>
|
|
|
- private void SubscribeData()
|
|
|
+ protected virtual void SubscribeValueAction()
|
|
|
{
|
|
|
- DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _persistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplierData", () => _sideAPowerSupplier.PowerSupplierData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplierData", () => _sideBPowerSupplier.PowerSupplierData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.ID", () => _sideAPowerSupplier.Module, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.IsConnected", () => _sideAPowerSupplier.IsConnected, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.Voltage", () => _sideAPowerSupplier.PowerSupplierData.Voltage, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.Current", () => _sideAPowerSupplier.PowerSupplierData.Current, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.SetPoint", () => _sideAPowerSupplier.PowerSupplierData.SetPoint, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.RunModel", () => _sideAPowerSupplier.PowerSupplierData.PowerRunModelContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.PowerControl", () => _sideAPowerSupplier.PowerSupplierData.PowerControlContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.PowerStatus", () => _sideAPowerSupplier.PowerSupplierData.PowerStatusContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideAPowerSupplier.Enable", () => _sideBPowerSupplier.PowerSupplierData.Enabled, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.ID", () => _sideBPowerSupplier.Module, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.IsConnected", () => _sideAPowerSupplier.IsConnected, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.Voltage", () => _sideBPowerSupplier.PowerSupplierData.Voltage, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.Current", () => _sideBPowerSupplier.PowerSupplierData.Current, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.SetPoint", () => _sideBPowerSupplier.PowerSupplierData.SetPoint, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.RunModel", () => _sideBPowerSupplier.PowerSupplierData.PowerRunModelContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.PowerControl", () => _sideBPowerSupplier.PowerSupplierData.PowerControlContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.PowerStatus", () => _sideBPowerSupplier.PowerSupplierData.PowerStatusContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.SideBPowerSupplier.Enable", () => _sideBPowerSupplier.PowerSupplierData.Enabled, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Linmot.ID", () => _linmotAxis.Module, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Linmot.IsMotorOn", () => _linmotAxis.IsMotorOn, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Linmot.IsError", () => _linmotAxis.IsError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Linmot.IsSwitchOn", () => _linmotAxis.IsSwitchOn, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Linmot.CurveSpeed", () => _linmotAxis.CurveSpeed, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Linmot.ErrorCode", () => _linmotAxis.ErrorCode, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Linmot.CurrentPosition", () => _linmotAxis.CurrentPosition, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ IoSubscribeUpdateVariable(IS_HEAD_TILT);
|
|
|
+ IoSubscribeUpdateVariable(IS_HEAD_VERTICAL);
|
|
|
+ IoSubscribeUpdateVariable(CLAMSHELL_DISTANCE);
|
|
|
+ IoSubscribeUpdateVariable(CLAMSHELL_CYLINDER_PRESSURE);
|
|
|
+ IoSubscribeUpdateVariable(OVERFLOW_LEVEL);
|
|
|
+ IoSubscribeUpdateVariable(CLAMSHELL_CLOSE);
|
|
|
+ IoSubscribeUpdateVariable(HEAD_TILT);
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
/// <summary>
|
|
|
- /// 初始化操作
|
|
|
+ /// 订阅IO变量
|
|
|
/// </summary>
|
|
|
- protected virtual void InitializeOperation()
|
|
|
+ /// <param name="variable"></param>
|
|
|
+ protected void IoSubscribeUpdateVariable(string variable)
|
|
|
{
|
|
|
- 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); });
|
|
|
+ _variableInitializeDic[variable] = false;
|
|
|
+ IOModuleManager.Instance.SubscribeModuleVariable(Module, variable, UpdateVariableValue);
|
|
|
}
|
|
|
/// <summary>
|
|
|
- /// 开始Curve
|
|
|
+ /// 更新变量数值
|
|
|
/// </summary>
|
|
|
- /// <param name="speed"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public bool StartCurveMotion(int speed)
|
|
|
+ /// <param name="variable"></param>
|
|
|
+ /// <param name="value"></param>
|
|
|
+ private void UpdateVariableValue(string variable, object value)
|
|
|
{
|
|
|
- if (_linmotAxis != null)
|
|
|
+ if (!_platingCellData.IsDataInitialized)
|
|
|
{
|
|
|
- return _linmotAxis.StartCurve(speed);
|
|
|
+ _platingCellData.IsDataInitialized = true;
|
|
|
}
|
|
|
- else
|
|
|
+ PropertyInfo property = _platingCellData.GetType().GetProperty(variable);
|
|
|
+ if (property != null)
|
|
|
{
|
|
|
- LOG.WriteLog(eEvent.ERR_METAL, Module, "linmot is null");
|
|
|
- return false;
|
|
|
+ property.SetValue(_platingCellData, value);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 开始Curve
|
|
|
- /// </summary>
|
|
|
- /// <param name="speed"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public bool ChangeCurveSpeedMotion(int speed)
|
|
|
- {
|
|
|
- if (_linmotAxis != null)
|
|
|
+ if (_variableInitializeDic.ContainsKey(variable) && !_variableInitializeDic[variable])
|
|
|
{
|
|
|
- return _linmotAxis.ChangeCurveSpeed(speed);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_METAL, Module, "linmot is null");
|
|
|
- return false;
|
|
|
+ _variableInitializeDic[variable] = true;
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
- /// ResetLinmot
|
|
|
+ /// 写变量
|
|
|
/// </summary>
|
|
|
+ /// <param name="variable"></param>
|
|
|
+ /// <param name="value"></param>
|
|
|
/// <returns></returns>
|
|
|
- public bool ResetLinmot()
|
|
|
+ protected bool WriteVariableValue(string variable, object value)
|
|
|
{
|
|
|
- if (_linmotAxis != null)
|
|
|
- {
|
|
|
- return _linmotAxis.ResetOperation("", false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_METAL, Module, "linmot is null");
|
|
|
- return false;
|
|
|
- }
|
|
|
+ string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{variable}");
|
|
|
+ return IOModuleManager.Instance.WriteIoValue(ioName, value);
|
|
|
}
|
|
|
/// <summary>
|
|
|
- /// 检验Linmot Routine状态是否为结束状态
|
|
|
+ /// 订阅数据
|
|
|
/// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public bool CheckLinmotRoutineEnd()
|
|
|
+ private void SubscribeData()
|
|
|
{
|
|
|
- if (_linmotAxis != null)
|
|
|
- {
|
|
|
- return _linmotAxis.Status == RState.End;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_METAL, Module, "linmot is null");
|
|
|
- return false;
|
|
|
- }
|
|
|
+ DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _persistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
/// <summary>
|
|
|
- /// 检验Linmot Routine状态是否为错误状态
|
|
|
+ /// 初始化操作
|
|
|
/// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public bool CheckLinmotRoutineError()
|
|
|
+ protected virtual void InitializeOperation()
|
|
|
{
|
|
|
- if (_linmotAxis != null)
|
|
|
- {
|
|
|
- return _linmotAxis.Status == RState.Failed || _linmotAxis.Status == RState.Timeout;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ 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(); });
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 停止Linmot
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public bool StopLinmot()
|
|
|
+ #region Operation
|
|
|
+ public bool ClamShellClose()
|
|
|
{
|
|
|
- if (_linmotAxis != null)
|
|
|
- {
|
|
|
- return _linmotAxis.StopOperation("", null);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_METAL, Module, "linmot is null");
|
|
|
- return false;
|
|
|
- }
|
|
|
+ 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);
|
|
|
}
|
|
|
-
|
|
|
- #region Operation
|
|
|
/// <summary>
|
|
|
/// DisabledAction
|
|
|
/// </summary>
|
|
@@ -298,28 +252,27 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
/// <returns></returns>
|
|
|
public bool DisabledOperation(string cmd, object[] args)
|
|
|
{
|
|
|
- //string currentOperation = "Disabled";
|
|
|
- //MetalEntity metalEntity = Singleton<RouteManager>.Instance.GetModule<MetalEntity>(Module);
|
|
|
- //if (metalEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
|
|
|
- //{
|
|
|
- // string preOperation = _persistentValue.OperatingMode;
|
|
|
- // if (metalEntity.IsBusy)
|
|
|
- // {
|
|
|
- // LOG.WriteLog(eEvent.ERR_METAL, 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;
|
|
|
- // }
|
|
|
- // metalEntity.EnterInit();
|
|
|
- // _persistentValue.OperatingMode = currentOperation;
|
|
|
-
|
|
|
- // LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
- //}
|
|
|
+ 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_METAL, 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;
|
|
|
|
|
|
- //MetalPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+ PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
return true;
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -330,28 +283,28 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
/// <returns></returns>
|
|
|
public bool ManualOperation(string cmd, object[] args)
|
|
|
{
|
|
|
- //string currentOperation = "Manual";
|
|
|
- //MetalEntity metalEntity = Singleton<RouteManager>.Instance.GetModule<MetalEntity>(Module);
|
|
|
- //if (metalEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
|
|
|
- //{
|
|
|
- // string preOperation = _persistentValue.OperatingMode;
|
|
|
- // if (metalEntity.IsBusy)
|
|
|
- // {
|
|
|
- // LOG.WriteLog(eEvent.ERR_METAL, 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;
|
|
|
- // }
|
|
|
- // metalEntity.EnterInit();
|
|
|
- // _persistentValue.OperatingMode = currentOperation;
|
|
|
+ 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_METAL, 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_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
- //}
|
|
|
+ LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
|
|
|
- //MetalPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
return true;
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -362,23 +315,22 @@ namespace PunkHPX8_RT.Devices.PlatingCell
|
|
|
/// <returns></returns>
|
|
|
public bool AutoOperation(string cmd, object[] args)
|
|
|
{
|
|
|
- //string currentOperation = "Auto";
|
|
|
- //MetalEntity metalEntity = Singleton<RouteManager>.Instance.GetModule<MetalEntity>(Module);
|
|
|
- //if (metalEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
|
|
|
- //{
|
|
|
- // string preOperation = _persistentValue.OperatingMode;
|
|
|
- // if (metalEntity.IsBusy)
|
|
|
- // {
|
|
|
- // LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is Busy, can't switch to Auto mode");
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // metalEntity.EnterInit();
|
|
|
- // _persistentValue.OperatingMode = currentOperation;
|
|
|
-
|
|
|
- // LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
- //}
|
|
|
+ string currentOperation = "Auto";
|
|
|
+ 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_METAL, Module, $"{Module} is Busy, can't switch to Auto mode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ platingCellEntity.EnterInit();
|
|
|
+ _persistentValue.OperatingMode = currentOperation;
|
|
|
|
|
|
- //MetalPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+ PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
return true;
|
|
|
}
|
|
|
/// <summary>
|